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%2Frelations%2FCHRConstraint.java;h=839f0930e23cc276d1538a57e25217555739b130;hp=c0f43928877458cbb9a9241ad3e764481acd3ce5;hb=e12e3ad357853a07b24923b341c4732962a94623;hpb=78f577368ba4c71ad6fb3d9f16c03c634585cf7b diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/relations/CHRConstraint.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/relations/CHRConstraint.java index c0f439288..839f0930e 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/relations/CHRConstraint.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/relations/CHRConstraint.java @@ -30,10 +30,12 @@ import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; import gnu.trove.map.hash.TIntObjectHashMap; +import gnu.trove.set.hash.THashSet; public class CHRConstraint extends Symbol implements CHRRelation { public final String name; public final Type[] parameterTypes; + public String[] fieldNames; public boolean implicitlyDeclared; @@ -79,11 +81,14 @@ public class CHRConstraint extends Symbol implements CHRRelation { this.name = name; this.parameterTypes = parameterTypes; } + + public void setParent(CHRRuleset parentRuleset) { + this.parentRuleset = parentRuleset; + } public void initializeCodeGeneration(CompilationContext context, CHRRuleset parentRuleset) { JavaTypeTranslator jtt = context.javaTypeTranslator; - this.parentRuleset = parentRuleset; this.factClassName = parentRuleset.runtimeRulesetClassName + "$" + name; TCon factTypeConstructor = Types.con(parentRuleset.runtimeRulesetType.module, parentRuleset.runtimeRulesetType.name + "$" + name); this.factType = Types.apply(factTypeConstructor, TVar.EMPTY_ARRAY); @@ -229,4 +234,19 @@ public class CHRConstraint extends Symbol implements CHRRelation { else return w.apply(location, accessor, fact); } + + @Override + public String[] getFieldNames() { + return fieldNames; + } + + @Override + public void collectEnforceEffects(THashSet effects) { + effects.add(Types.PROC); + } + + @Override + public void collectQueryEffects(THashSet effects) { + effects.add(Types.PROC); + } }