Merge pull request #9225 from ethereum/fixLocationOfYulAssignment

Fix location of yul assignment
This commit is contained in:
chriseth 2020-06-18 15:54:46 +02:00 committed by GitHub
commit b1d22ab2c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View File

@ -11,6 +11,7 @@ Compiler Features:
Bugfixes:
* NatSpec: Do not consider ``////`` and ``/***`` as NatSpec comments.
* Type Checker: Fix internal error related to ``using for`` applied to non-libraries.
* Yul: Fix source location of variable multi-assignment.
### 0.6.10 (2020-06-11)

View File

@ -175,7 +175,8 @@ Statement Parser::parseStatement()
case Token::Comma:
case Token::AssemblyAssign:
{
std::vector<Identifier> variableNames;
Assignment assignment;
assignment.location = locationOf(elementary);
while (true)
{
@ -197,7 +198,7 @@ Statement Parser::parseStatement()
if (m_dialect.builtin(identifier.name))
fatalParserError(6272_error, "Cannot assign to builtin function \"" + identifier.name.str() + "\".");
variableNames.emplace_back(identifier);
assignment.variableNames.emplace_back(identifier);
if (currentToken() != Token::Comma)
break;
@ -207,10 +208,6 @@ Statement Parser::parseStatement()
elementary = parseElementaryOperation();
}
Assignment assignment;
assignment.location = std::get<Identifier>(elementary).location;
assignment.variableNames = std::move(variableNames);
expectToken(Token::AssemblyAssign);
assignment.value = make_unique<Expression>(parseExpression());

View File

@ -0,0 +1,8 @@
contract C {
function f() pure public {
uint x; uint y;
assembly { x, y := 7 }
}
}
// ----
// DeclarationError: (87-96): Variable count does not match number of values (2 vs. 1)