Skip to content

Commit

Permalink
Better error messages during parsing functional instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed May 24, 2017
1 parent 451acd4 commit 56fe3a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### 0.4.12 (unreleased)

Features:
* AST: export all attributes to Json format
* Inline Assembly: Present proper error message when not supplying enough arguments to a functional
instruction.

Bugfixes:
* Unused variable warnings no longer issued for variables used inside inline assembly
Expand Down
9 changes: 9 additions & 0 deletions libsolidity/inlineasm/AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ assembly::Statement Parser::parseCall(assembly::Statement&& _instruction)
unsigned args = unsigned(instrInfo.args);
for (unsigned i = 0; i < args; ++i)
{
/// check for premature closing parentheses
if (m_scanner->currentToken() == Token::RParen)
fatalParserError(string(
"Expected " +
boost::lexical_cast<string>(args) +
" arguments, but received " +
boost::lexical_cast<string>(i)
));

ret.arguments.emplace_back(parseExpression());
if (i != args - 1)
{
Expand Down

0 comments on commit 56fe3a6

Please sign in to comment.