use of mb.nabl2.constraints.scopegraph.CGImportEdge in project nabl by metaborg.
the class ScopeGraphComponent method solve.
private boolean solve(CGImportEdge c) {
ITerm scopeRep = unifier().findRecursive(c.getScope());
if (!scopeRep.isGround()) {
return false;
}
Scope scope = Scope.matcher().match(scopeRep, unifier()).orElseThrow(() -> new TypeException("Expected a scope but got " + scopeRep));
return findOccurrence(c.getReference()).map(ref -> {
scopeGraph.addImportEdge(scope, c.getLabel(), ref);
return true;
}).orElseGet(() -> {
scopeGraph.addIncompleteImportEdge(scope, c.getLabel(), c.getReference());
return true;
});
}
Aggregations