1 package org.simantics.scl.compiler.elaboration.chr;
3 import org.simantics.scl.compiler.constants.Constant;
4 import org.simantics.scl.compiler.constants.JavaConstructor;
5 import org.simantics.scl.compiler.internal.codegen.chr.CHRCodeGenerator;
6 import org.simantics.scl.compiler.internal.codegen.references.BoundVar;
7 import org.simantics.scl.compiler.internal.codegen.ssa.SSAObject;
8 import org.simantics.scl.compiler.internal.codegen.utils.ModuleBuilder;
9 import org.simantics.scl.compiler.types.Types;
11 public class CHRRulesetObject extends SSAObject {
14 public CHRRulesetObject(BoundVar target, CHRRuleset ruleset) {
15 super(ruleset.storeType);
16 this.setTarget(target);
17 this.ruleset = ruleset;
21 public Constant liftClosure(BoundVar newTarget, BoundVar[] parameters) {
22 ruleset.this_ = newTarget;
23 ruleset.parameters = parameters;
24 return new JavaConstructor(ruleset.storeClassName, Types.PROC, ruleset.storeType, Types.getTypes(parameters));
28 public void generateCode(ModuleBuilder moduleBuilder) {
29 CHRCodeGenerator.generateStore(moduleBuilder, ruleset);