
org.snapscript.compile.validate.ModuleValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.compile.validate;
import java.util.List;
import org.snapscript.core.InternalStateException;
import org.snapscript.core.Module;
import org.snapscript.core.Type;
import org.snapscript.core.TypeExtractor;
import org.snapscript.core.convert.ConstraintMatcher;
public class ModuleValidator {
private final TypeValidator validator;
public ModuleValidator(ConstraintMatcher matcher, TypeExtractor extractor) {
this.validator = new TypeValidator(matcher, extractor);
}
public void validate(Module module) throws Exception {
List types = module.getTypes();
String name = module.getName();
for(Type type : types) {
try {
validator.validate(type);
}catch(Exception e) {
throw new InternalStateException("Invalid reference to '" + type +"' in '" + name + "'", e);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy