1 package org.simantics.scl.compiler.constants.singletons;
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.constants.FunctionValue;
5 import org.simantics.scl.compiler.internal.codegen.references.Val;
6 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
7 import org.simantics.scl.compiler.types.TVar;
8 import org.simantics.scl.compiler.types.Type;
9 import org.simantics.scl.compiler.types.Types;
10 import org.simantics.scl.compiler.types.kinds.Kinds;
12 public class ListElement extends FunctionValue {
13 private static TVar A = Types.var(Kinds.STAR);
14 public static final ListElement INSTANCE = new ListElement();
16 private ListElement() {
17 super(new TVar[] {A}, Types.NO_EFFECTS, A, Types.list(A), Types.INTEGER);
21 public Type applyExact(MethodBuilder mb, Val[] parameters) {
22 parameters[0].push(mb);
23 parameters[1].push(mb);
24 mb.invokeInterface("java/util/List", "get", TypeDesc.OBJECT, new TypeDesc[] {TypeDesc.INT});
25 return getReturnType();
29 public String toString() {