unhandled throw() now reports as error. Fixes #446
This commit is contained in:
1 parent
33f400e904
commit
cbe91b4759
2 files changed
+4
-3
No files matched your search
@@ -19,6 +19,7 @@ import carpet.script.exception.ExpressionException;
|
|||||||
import carpet.script.exception.InternalExpressionException;
|
import carpet.script.exception.InternalExpressionException;
|
||||||
import carpet.script.exception.ResolvedException;
|
import carpet.script.exception.ResolvedException;
|
||||||
import carpet.script.exception.ReturnStatement;
|
import carpet.script.exception.ReturnStatement;
|
||||||
|
import carpet.script.exception.ThrowStatement;
|
||||||
import carpet.script.language.Arithmetic;
|
import carpet.script.language.Arithmetic;
|
||||||
import carpet.script.language.ControlFlow;
|
import carpet.script.language.ControlFlow;
|
||||||
import carpet.script.language.DataStructures;
|
import carpet.script.language.DataStructures;
|
||||||
@@ -602,9 +603,9 @@ public class Expression
|
|||||||
{
|
{
|
||||||
return exprProvider.get().evalValue(c, expectedType);
|
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)
|
catch (ExitStatement exit)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction
|
|||||||
@Override
|
@Override
|
||||||
public double readDoubleNumber()
|
public double readDoubleNumber()
|
||||||
{
|
{
|
||||||
throw new InternalExpressionException("Function value has no numeric value");
|
return getNumParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user