Fix wrong location for inline asm blocks

This commit is contained in:
Mathias Baumann
2019-04-15 16:40:07 +02:00
parent bf5792f7ca
commit efc8d79d53
5 changed files with 45 additions and 6 deletions
+5 -3
View File
@@ -1036,7 +1036,8 @@ ASTPointer<Statement> Parser::parseStatement()
ASTPointer<InlineAssembly> Parser::parseInlineAssembly(ASTPointer<ASTString> const& _docString)
{
RecursionGuard recursionGuard(*this);
ASTNodeFactory nodeFactory(*this);
SourceLocation location{position(), -1, source()};
expectToken(Token::Assembly);
if (m_scanner->currentToken() == Token::StringLiteral)
{
@@ -1050,8 +1051,9 @@ ASTPointer<InlineAssembly> Parser::parseInlineAssembly(ASTPointer<ASTString> con
shared_ptr<yul::Block> block = asmParser.parse(m_scanner, true);
if (block == nullptr)
BOOST_THROW_EXCEPTION(FatalError());
nodeFactory.markEndPosition();
return nodeFactory.createNode<InlineAssembly>(_docString, block);
location.end = block->location.end;
return make_shared<InlineAssembly>(location, _docString, block);
}
ASTPointer<IfStatement> Parser::parseIfStatement(ASTPointer<ASTString> const& _docString)