Fix source location of yul multi-assignemnt.

This commit is contained in:
chriseth 2020-06-17 17:56:51 +02:00
parent d19aa2e51b
commit b00014c51d
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)