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%2Fchr%2FCHRRuleset.java;h=aa59d4c0239159b604d396be91710fb66d69cfda;hp=805e781e74a6eff0f2876ea43df82b86443395ca;hb=91682baa9a8252390f09b80fd724f47e5957b234;hpb=2df6133d08115f25494f7f8009b6601862895f6c diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java index 805e781e7..aa59d4c02 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java @@ -42,7 +42,6 @@ import org.simantics.scl.compiler.types.Types; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TObjectIntHashMap; -import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.TIntHashSet; public class CHRRuleset extends Symbol { @@ -136,13 +135,6 @@ public class CHRRuleset extends Symbol { rule.collectVars(allVars, vars); } - public void collectFreeVariables(THashSet vars) { - for(IncludeStatement include : includes) - include.value.collectFreeVariables(vars); - for(CHRRule rule : rules) - rule.collectFreeVariables(vars); - } - public void setLocationDeep(long loc) { if(location == Locations.NO_LOCATION) { this.location = loc; @@ -265,7 +257,7 @@ public class CHRRuleset extends Symbol { PlanRealizer realizer = new PlanRealizer(cachedContext, this, runtimeRulesetVariable, implementationParameters[0], plan.ops); realizer.nextOp(methodWriter); if(methodWriter.isUnfinished()) - methodWriter.return_(BooleanConstant.TRUE); + methodWriter.return_(rule.location, BooleanConstant.TRUE); } } if(!includes.isEmpty() || extensible) { @@ -281,7 +273,7 @@ public class CHRRuleset extends Symbol { methodWriter.apply(Locations.NO_LOCATION, new JavaMethod(true, runtimeRulesetClassName, "register", Types.PROC, Types.UNIT, new Type[] {runtimeRulesetType, Types.CHRContext}), object.getTarget(), methodWriter.getParameters()[0]); - methodWriter.return_(NoRepConstant.UNIT); + methodWriter.return_(location, NoRepConstant.UNIT); } { CodeWriter methodWriter = object.createMethod(w.getModuleWriter(), TVar.EMPTY_ARRAY, Types.PROC, Types.UNIT, new Type[] {Types.CHRContext}); @@ -295,7 +287,7 @@ public class CHRRuleset extends Symbol { methodWriter.apply(Locations.NO_LOCATION, new JavaMethod(true, runtimeRulesetClassName, "unregister", Types.PROC, Types.UNIT, new Type[] {runtimeRulesetType, Types.CHRContext}), object.getTarget(), methodWriter.getParameters()[0]); - methodWriter.return_(NoRepConstant.UNIT); + methodWriter.return_(location, NoRepConstant.UNIT); } } if(initConstraint != null) { @@ -317,15 +309,6 @@ public class CHRRuleset extends Symbol { return runtimeRulesetVariable; } - public void collectEffects(THashSet effects) { - for(CHRRule rule : rules) { - for(CHRLiteral literal : rule.head.literals) - literal.collectQueryEffects(effects); - for(CHRLiteral literal : rule.head.literals) - literal.collectEnforceEffects(effects); - } - } - public void addRule(CHRRule rule) { rules.add(rule); rule.parentRuleset = this;