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;
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);
+ }
}
@Test public void ConjunctionMacro() { test(); }
@Test public void Constant() { test(); }
@Test public void ConstructorNameClash() { test(); }
+ @Test public void DeconstructEnum() { test(); }
@Test public void DefaultMethods1() { test(); }
@Test public void Deriving3() { test(); }
@Test public void Deriving4() { test(); }