mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow assignment to non-identifiers.
This commit is contained in:
parent
f62e269115
commit
525758a130
@ -71,6 +71,8 @@ assembly::Statement Parser::parseStatement()
|
||||
expectToken(Token::Colon);
|
||||
assignment.variableName.location = location();
|
||||
assignment.variableName.name = m_scanner->currentLiteral();
|
||||
if (instructions().count(assignment.variableName.name))
|
||||
fatalParserError("Identifier expected.");
|
||||
assignment.location.end = endPosition();
|
||||
expectToken(Token::Identifier);
|
||||
return assignment;
|
||||
|
@ -194,6 +194,12 @@ BOOST_AUTO_TEST_CASE(inline_assembly_shadowed_instruction_assignment)
|
||||
BOOST_CHECK(!successAssemble("{ 2 =: gas }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(inline_assembly_shadowed_instruction_functional_assignment)
|
||||
{
|
||||
// Error message: "Cannot use instruction names for identifier names."
|
||||
BOOST_CHECK(!successAssemble("{ gas := 2 }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user