import org.simantics.scl.compiler.top.ExpressionInterpretationContext;
import org.simantics.scl.compiler.types.exceptions.MatchException;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
public class ECHRRulesetConstructor extends Expression {
- CHRRuleset ruleset;
+ public CHRRuleset ruleset;
public ECHRRulesetConstructor(CHRRuleset ruleset) {
this.ruleset = ruleset;
}
- @Override
- public void collectVars(TObjectIntHashMap<Variable> allVars, TIntHashSet vars) {
- ruleset.collectVars(allVars, vars);
- }
-
@Override
protected void updateType() throws MatchException {
throw new InternalCompilerError("Type of ECHRRulesetConstructor should be already given.");
return ruleset.generateCode(w);
}
- @Override
- public void collectFreeVariables(THashSet<Variable> vars) {
- ruleset.collectFreeVariables(vars);
- }
-
@Override
public Expression resolve(TranslationContext context) {
context.pushFrame();
context.pushCHRConstraintFrame();
ruleset.resolve(context);
- context.popCHRConstraintFrame(ruleset.constraints);
+ context.popCHRConstraintFrame(ruleset);
context.popFrame();
return this;
}
@Override
public Expression simplify(SimplificationContext context) {
- ruleset.simplify(context);
- ruleset.compile(context);
+ ruleset.simplifyAndCompileIfNeeded(context);
return this;
}