use of mb.nabl2.constraints.scopegraph.CGRef in project nabl by metaborg.
the class ScopeGraphComponent method solve.
private boolean solve(CGRef c) {
final ITerm scopeTerm = unifier().findRecursive((c.getScope()));
final ITerm refTerm = unifier().findRecursive((c.getReference()));
if (!(scopeTerm.isGround() && refTerm.isGround())) {
return false;
}
Occurrence ref = Occurrence.matcher().match(refTerm, unifier()).orElseThrow(() -> new TypeException("Expected an occurrence as first argument to " + c));
Scope scope = Scope.matcher().match(scopeTerm, unifier()).orElseThrow(() -> new TypeException("Expected a scope as second argument to " + c));
scopeGraph.addRef(ref, scope);
return true;
}
Aggregations