AsmParser: Fix error handling in function call parsing.

This commit is contained in:
Christian Parpart 2019-09-18 14:10:55 +02:00 committed by Christian Parpart
parent 7fe0f58445
commit 2390b1bfd4

View File

@ -321,12 +321,8 @@ Parser::ElementaryOperation Parser::parseElementaryOperation()
{
Identifier identifier{location(), literal};
advance();
if (m_scanner->currentToken() == Token::LParen)
return FunctionCall{identifier.location, identifier, {}};
else if (instructions().count(identifier.name.str()))
m_errorReporter.syntaxError(identifier.location, "Instructions must be invoked function style. Expecting an '(' after the instruction.");
else
m_errorReporter.syntaxError(identifier.location, "Invalid identifier.");
expectToken(Token::LParen, false);
return FunctionCall{identifier.location, identifier, {}};
}
else
ret = Identifier{location(), literal};