Skip to content
Snippets Groups Projects
Commit 095f69f1 authored by dgelessus's avatar dgelessus
Browse files

Throw check exceptions immediately when an error is encountered

This is possible now that the exceptions are unchecked.
parent 1901b1d3
No related branches found
No related tags found
No related merge requests found
......@@ -9,24 +9,18 @@ public class VOScopeChecker extends DepthFirstAdapter {
private final VOParser voParser;
private boolean error;
public VOScopeChecker(VOParser voParser) {
this.voParser = voParser;
this.error = false;
}
public void scopeCheck(Start start) {
start.apply(this);
if(error) {
throw new VOScopeCheckException("Scope error in VO");
}
}
@Override
public void caseAIdentifierVo(AIdentifierVo node) {
if (!voParser.getTasks().containsKey(node.getIdentifierLiteral().getText())) {
error = true;
throw new VOScopeCheckException("Scope error in VO");
}
}
......
......@@ -14,21 +14,15 @@ public class VOTypeChecker extends DepthFirstAdapter {
private final VOParser voParser;
private boolean error;
private PersistentHashSet<AnimatorState> modifiedAnimatorState;
public VOTypeChecker(VOParser voParser) {
this.voParser = voParser;
this.error = false;
this.modifiedAnimatorState = PersistentHashSet.create(AnimatorState.STATE_SPACE, AnimatorState.TRACE);
}
public void typeCheck(Start start) {
start.apply(this);
if (error) {
throw new VOTypeCheckException("Type error in VO");
}
}
private PersistentHashSet<AnimatorState> visitVOExpression(Node node, PersistentHashSet<AnimatorState> animatorState) {
......@@ -129,7 +123,7 @@ public class VOTypeChecker extends DepthFirstAdapter {
break;
}
if(!valid) {
error = true;
throw new VOTypeCheckException("Type error in VO");
}
return newAnimatorState;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment