remove error handling, since these kinds of errors are caught by our context analysis

This commit is contained in:
2020-02-03 22:24:27 +01:00
parent 3e8a904cb8
commit 3a89ab2231

View File

@@ -152,13 +152,7 @@ public class EvalVisitor implements Visitor<Value> {
@Override
public Value visit(Variable e) {
Value result = this.env.get(e.name);
if (result == null) {
throw new RuntimeException("Variable with name " + e.name + " not found.");
}
return result;
return this.env.get(e.name);
}
@Override
@@ -271,11 +265,6 @@ public class EvalVisitor implements Visitor<Value> {
// Die funktionsdefinition speichern
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
Map<String, Value> newEnv = new HashMap<>();
for (int i = 0; i < func.parameters.length; i++) {