package org.simantics.scl.compiler.constants.generic;
import org.cojen.classfile.TypeDesc;
+import org.objectweb.asm.Label;
import org.simantics.scl.compiler.constants.FunctionValue;
+import org.simantics.scl.compiler.internal.codegen.continuations.Cont;
+import org.simantics.scl.compiler.internal.codegen.references.IVal;
import org.simantics.scl.compiler.internal.codegen.references.Val;
import org.simantics.scl.compiler.internal.codegen.types.JavaReferenceValidator;
+import org.simantics.scl.compiler.internal.codegen.utils.Constants;
import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
import org.simantics.scl.compiler.types.TVar;
import org.simantics.scl.compiler.types.Type;
MethodRef m2 = other.methodRef;
TypeDesc[] ps1 = m1.getParameterTypes();
TypeDesc[] ps2 = m2.getParameterTypes();
- if(ps1.length != ps2.length)
- return INCOMPARABLE;
+ if(ps1.length != ps2.length) {
+ if(ps1.length < ps2.length)
+ return LESS;
+ else
+ return GREATER;
+ }
boolean lessOrEqual = true;
boolean greaterOrEqual = true;
for(StackItem item : stackItems)
item.prepare(mb);
}
+
+ @Override
+ public void deconstruct(MethodBuilder mb, IVal parameter, Cont success,
+ Label failure) {
+ if(parameterTypes.length != 0)
+ super.deconstruct(mb, parameter, success, failure);
+ push(mb);
+ mb.push(parameter, getType());
+ mb.invokeVirtual(TypeDesc.OBJECT, "equals", TypeDesc.BOOLEAN, Constants.OBJECTS[1]);
+ mb.ifZeroComparisonBranch(failure, "==");
+ mb.jump(success);
+ }
}