Assert integrity of empty IndexAccessPath structure.

This commit is contained in:
chriseth 2018-05-09 14:55:36 +02:00
parent be54f48197
commit fe8f38a7a4
2 changed files with 11 additions and 1 deletions

View File

@ -1098,6 +1098,16 @@ ASTPointer<Statement> Parser::parseSimpleStatement(ASTPointer<ASTString> const&
}
}
bool Parser::IndexAccessedPath::empty() const
{
if (!indices.empty())
{
solAssert(!path.empty(), "");
}
return path.empty() && indices.empty();
}
pair<Parser::LookAheadInfo, Parser::IndexAccessedPath> Parser::tryParseIndexAccessedPath()
{
// These two cases are very hard to distinguish:

View File

@ -151,7 +151,7 @@ private:
{
std::vector<ASTPointer<PrimaryExpression>> path;
std::vector<std::pair<ASTPointer<Expression>, SourceLocation>> indices;
bool empty() const { return path.empty() && indices.empty(); }
bool empty() const;
};
std::pair<LookAheadInfo, IndexAccessedPath> tryParseIndexAccessedPath();