org.snapscript.compile.verify.ExecutableVerifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap-all Show documentation
Show all versions of snap-all Show documentation
Dynamic scripting for the JVM
package org.snapscript.compile.verify;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.snapscript.core.trace.Trace;
import org.snapscript.core.trace.TraceErrorCollector;
public class ExecutableVerifier extends TraceErrorCollector implements Verifier {
private final List errors;
public ExecutableVerifier() {
this.errors = new CopyOnWriteArrayList();
}
@Override
public void compileError(Exception cause, Trace trace) {
VerifyError error = new VerifyError(cause, trace);
errors.add(error);
}
@Override
public void verify(){
if(!errors.isEmpty()) {
throw new VerifyException("Compilation errors found " + errors, errors);
}
}
}