X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fexpressions%2FECHRRulesetConstructor.java;h=dbba5a5390d93a99a5a010ea5baad5bc23bcb627;hp=7df6fb595732f88b26c12b826673905679bfceb7;hb=e12e3ad357853a07b24923b341c4732962a94623;hpb=a8d72a172fdc815c8a9f0f584f010f7e35286f92 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java index 7df6fb595..dbba5a539 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java @@ -13,22 +13,13 @@ import org.simantics.scl.compiler.internal.interpreted.IExpression; 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 allVars, TIntHashSet vars) { - ruleset.collectVars(allVars, vars); - } - @Override protected void updateType() throws MatchException { throw new InternalCompilerError("Type of ECHRRulesetConstructor should be already given."); @@ -39,17 +30,12 @@ public class ECHRRulesetConstructor extends Expression { return ruleset.generateCode(w); } - @Override - public void collectFreeVariables(THashSet 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; } @@ -73,8 +59,7 @@ public class ECHRRulesetConstructor extends Expression { @Override public Expression simplify(SimplificationContext context) { - ruleset.simplify(context); - ruleset.compile(context); + ruleset.simplifyAndCompileIfNeeded(context); return this; }