1 package org.simantics.scl.compiler.constants;
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.internal.codegen.references.Val;
5 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
6 import org.simantics.scl.compiler.types.TVar;
7 import org.simantics.scl.compiler.types.Type;
8 import org.simantics.scl.compiler.types.Types;
9 import org.simantics.scl.compiler.types.kinds.Kinds;
11 public class FailFunction extends FunctionValue {
13 private static final TVar A = Types.var(Kinds.STAR);
14 public static final FailFunction INSTANCE =
17 private FailFunction() {
18 super(new TVar[] {A}, Types.NO_EFFECTS, A, Types.STRING);
21 private static final TypeDesc RuntimeException =
22 TypeDesc.forClass(RuntimeException.class);
25 public Type applyExact(MethodBuilder mb, Val[] parameters) {
26 mb.newObject(RuntimeException);
28 mb.push(parameters, parameterTypes);
29 mb.invokeConstructor(RuntimeException,
30 new TypeDesc[] {TypeDesc.STRING});
32 return getReturnType();
36 public String toString() {