X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fcodegen%2Fchr%2FCHRCodeGenerator.java;fp=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fcodegen%2Fchr%2FCHRCodeGenerator.java;h=c4842ea612a1ac23cf49b3d1ce4418d332715379;hb=cde82ba81327d5515fdca362f7f4c70f5103ae80;hp=af06463bbe7a1672f2bb9fe2e8ea10e97b4b5aa7;hpb=bf540e621923947f9d6f4d5eeef5d05f08373125;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/chr/CHRCodeGenerator.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/chr/CHRCodeGenerator.java index af06463bb..c4842ea61 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/chr/CHRCodeGenerator.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/chr/CHRCodeGenerator.java @@ -57,8 +57,12 @@ public class CHRCodeGenerator { generateFact(storeClassBuilder, constraint, hashIndexInitializations); // Fields - for(int i=0;i>i)&1)==1) { - mb.loadLocal(tempFactVar); - mb.loadLocal(mb.getParameter(parameterId++)); - mb.storeField(factClassName, "c"+i, parameterTypeDescs[i]); + TypeDesc typeDesc = parameterTypeDescs[i]; + if(!typeDesc.equals(TypeDesc.VOID)) { + mb.loadLocal(tempFactVar); + mb.loadLocal(mb.getParameter(parameterId)); + mb.storeField(factClassName, fieldName(i), typeDesc); + } + ++parameterId; } mb.loadThis(); @@ -521,20 +537,26 @@ public class CHRCodeGenerator { // this.c1 = c1; // } - TypeDesc[] constructorParameters = new TypeDesc[parameterTypeDescs.length+1]; - constructorParameters[0] = FACT_ID_TYPE; - for(int i=0;i constructorParameters = new ArrayList(parameterTypeDescs.length+1); + constructorParameters.add(FACT_ID_TYPE); + for(TypeDesc typeDesc : parameterTypeDescs) { + if(typeDesc.equals(TypeDesc.VOID)) + continue; + constructorParameters.add(typeDesc); + } + MethodBuilderBase mb = factClassBuilder.addConstructor(Opcodes.ACC_PUBLIC, constructorParameters.toArray(new TypeDesc[constructorParameters.size()])); mb.loadThis(); mb.invokeConstructor(factClassBuilder.getSuperClassName(), Constants.EMPTY_TYPEDESC_ARRAY); mb.loadThis(); mb.loadLocal(mb.getParameter(0)); mb.storeField(factClassName, "id", FACT_ID_TYPE); - for(int i=0;i