remove error handling, since these kinds of errors are caught by our context analysis
This commit is contained in:
@@ -152,13 +152,7 @@ public class EvalVisitor implements Visitor<Value> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Value visit(Variable e) {
|
public Value visit(Variable e) {
|
||||||
Value result = this.env.get(e.name);
|
return this.env.get(e.name);
|
||||||
|
|
||||||
if (result == null) {
|
|
||||||
throw new RuntimeException("Variable with name " + e.name + " not found.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -271,11 +265,6 @@ public class EvalVisitor implements Visitor<Value> {
|
|||||||
// Die funktionsdefinition speichern
|
// Die funktionsdefinition speichern
|
||||||
FunctionDefinition func = this.funcs.get(e.name);
|
FunctionDefinition func = this.funcs.get(e.name);
|
||||||
|
|
||||||
// Stelle sicher, dass die Länge der argumente und parameter übereinstimmen
|
|
||||||
if (e.arguments.length != func.parameters.length) {
|
|
||||||
throw new RuntimeException("Error with function call " + e.name + ": Number of parameters wrong");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Baue ein neues environment
|
// Baue ein neues environment
|
||||||
Map<String, Value> newEnv = new HashMap<>();
|
Map<String, Value> newEnv = new HashMap<>();
|
||||||
for (int i = 0; i < func.parameters.length; i++) {
|
for (int i = 0; i < func.parameters.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user