Skip to content

Commit

Permalink
Turn assertion into error
Browse files Browse the repository at this point in the history
I think this assertion has shown itself to be valuable. It should indeed be an error.

The case I now stumbled over it was with missing terminating dots for expressions in variable declarations, so, I included this in the error message.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Apr 7, 2020
1 parent 1991b7b commit 8159324
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/som/compiler/Parser.java
Expand Up @@ -1402,7 +1402,15 @@ private ExpressionNode binaryOperand(final MethodBuilder builder)
evenutalSend = accept(EventualSend, KeywordTag.class);
}

assert !evenutalSend : "eventualSend should not be true, because that means we steal it from the next operation (think here shouldn't be one, but still...)";
if (evenutalSend) {
// eventualSend should not be true, because that means we steal it from the next
// operation (think here shouldn't be one, but still...)
throw new ParseError(
"Parsing something unexpectedly as eventual send. " +
"Perhaps some variable declaration statement is not terminated?",
Symbol.NONE, this);
}

return operand;
}

Expand Down

0 comments on commit 8159324

Please sign in to comment.