import org.simantics.scl.compiler.common.names.Name;
import org.simantics.scl.compiler.compilation.CompilationContext;
+import org.simantics.scl.compiler.elaboration.chr.CHRRuleset;
import org.simantics.scl.compiler.elaboration.contexts.TypeTranslationContext;
import org.simantics.scl.compiler.elaboration.modules.SCLValue;
import org.simantics.scl.compiler.elaboration.modules.TypeClass;
return getEnvironmentEntry(environment, localName, getTypeClass);
}
+ public static CHRRuleset getRuleset(Environment environment, String localName) throws AmbiguousNameException {
+ return getEnvironmentEntry(environment, localName, getRuleset);
+ }
+
/**
* Get the Name object representing an SCL value defined in a given environment.
* The name can be a local name or a fully scoped name with modules separated by periods.
TypeAst typeAst = (TypeAst)parser.parseType();
TypeTranslationContext context = new TypeTranslationContext(compilationContext);
Type type = context.toType(typeAst);
- if(compilationContext.errorLog.isEmpty())
+ if(compilationContext.errorLog.hasNoErrors())
return type;
} catch(SCLSyntaxErrorException e) {
compilationContext.errorLog.log(e.location, e.getMessage());
Namespace childNamespace = namespace.getNamespace(prefix.substring(0, p));
if(childNamespace != null)
findValuesForPrefix(childNamespace, prefix.substring(p+1), proc);
+ else
+ namespace.findValuesForPrefix(prefix, AcceptAllNamespaceFilter.INSTANCE, proc);
}
else
namespace.findValuesForPrefix(prefix, AcceptAllNamespaceFilter.INSTANCE, proc);
return ns.getTypeClass(name);
}
};
+
+ private static final NamespaceValueAccessor<CHRRuleset> getRuleset = new NamespaceValueAccessor<CHRRuleset>() {
+ @Override
+ public CHRRuleset get(Namespace ns, String name) throws AmbiguousNameException {
+ return ns.getRuleset(name);
+ }
+ };
private static <T> T getEnvironmentEntry(Environment environment, String localName, NamespaceValueAccessor<T> accessor) throws AmbiguousNameException {
Namespace namespace = environment.getLocalNamespace();