Fix wrong construction of ElementaryTypeNameToken

And add an assert to prevent it in the future
This commit is contained in:
Mathias Baumann 2019-11-21 15:47:10 +01:00 committed by Mathias Baumann
parent e061f1e743
commit be615d4f2b
2 changed files with 4 additions and 1 deletions

View File

@ -72,6 +72,9 @@ void ElementaryTypeNameToken::assertDetails(Token _baseType, unsigned const& _fi
"No elementary type " + string(TokenTraits::toString(_baseType)) + to_string(_first) + "x" + to_string(_second) + "."
);
}
else
solAssert(_first == 0 && _second == 0, "Unexpected size arguments");
m_token = _baseType;
m_firstNumber = _first;
m_secondNumber = _second;

View File

@ -1678,7 +1678,7 @@ ASTPointer<Expression> Parser::parseLeftHandSideExpression(
expectToken(Token::Payable);
nodeFactory.markEndPosition();
auto expressionType = nodeFactory.createNode<ElementaryTypeName>(
ElementaryTypeNameToken(Token::Address, 160, 0),
ElementaryTypeNameToken(Token::Address, 0, 0),
std::make_optional(StateMutability::Payable)
);
expression = nodeFactory.createNode<ElementaryTypeNameExpression>(expressionType);