unhandled throw() now reports as error. Fixes #446

This commit is contained in:
gnembon committed 2020-09-10 00:32:36 -03:00
1 parent 33f400e904
commit cbe91b4759
2 files changed
+4 -3

No files matched your search

+3 -2
View File
@@ -19,6 +19,7 @@ import carpet.script.exception.ExpressionException;
import carpet.script.exception.InternalExpressionException;
import carpet.script.exception.ResolvedException;
import carpet.script.exception.ReturnStatement;
import carpet.script.exception.ThrowStatement;
import carpet.script.language.Arithmetic;
import carpet.script.language.ControlFlow;
import carpet.script.language.DataStructures;
@@ -602,9 +603,9 @@ public class Expression
{
return exprProvider.get().evalValue(c, expectedType);
}
catch (ContinueStatement | BreakStatement | ReturnStatement exc)
catch (ContinueStatement | BreakStatement | ReturnStatement | ThrowStatement exc)
{
throw new ExpressionException(c, this, "Control flow functions, like continue, break, or return, should only be used in loops and functions respectively.");
throw new ExpressionException(c, this, "Control flow functions, like continue, break, throw or return, should only be used in loops, try blocks, and functions respectively.");
}
catch (ExitStatement exit)
{