- for(int i=0;i<parameterTypes.length;++i)
- constructorTypes[i+1] = parameterTypes[i];
- this.constructor = new JavaConstructor(factClassName, Types.PROC, factType, constructorTypes);
+ ArrayList<StackItem> stackItems = new ArrayList<StackItem>(constructorTypes.length);
+ stackItems.add(new ParameterStackItem(0, Types.INTEGER));
+ for(int i=0;i<parameterTypes.length;++i) {
+ Type parameterType = parameterTypes[i];
+ constructorTypes[i+1] = parameterType;
+ if(!parameterType.equals(Types.UNIT))
+ stackItems.add(new ParameterStackItem(stackItems.size(), parameterType));
+ }
+ TypeDesc[] constructorTypeDescs = JavaTypeTranslator.filterVoid(jtt.toTypeDescs(constructorTypes));
+ this.constructor = new CallJava(TVar.EMPTY_ARRAY, Types.PROC, factType, constructorTypes,
+ stackItems.toArray(new StackItem[stackItems.size()]),
+ new ConstructorRef(factClassName, constructorTypeDescs),
+ null);
+ //this.constructor = new JavaConstructor(factClassName, Types.PROC, factType, constructorTypes);