X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fconstants%2Fsingletons%2FListLength.java;h=e3e6362ae39f972562f6445c9f83e1ccba3e7226;hp=148db392db48343878ba099cbc061bd6affc2607;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/singletons/ListLength.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/singletons/ListLength.java index 148db392d..e3e6362ae 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/singletons/ListLength.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/singletons/ListLength.java @@ -1,32 +1,32 @@ -package org.simantics.scl.compiler.constants.singletons; - -import org.cojen.classfile.TypeDesc; -import org.simantics.scl.compiler.constants.FunctionValue; -import org.simantics.scl.compiler.internal.codegen.references.Val; -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; -import org.simantics.scl.compiler.types.Types; -import org.simantics.scl.compiler.types.kinds.Kinds; - -public class ListLength extends FunctionValue { - private static TVar A = Types.var(Kinds.STAR); - public static final ListLength INSTANCE = new ListLength(); - - private ListLength() { - super(new TVar[] {A}, Types.NO_EFFECTS, Types.INTEGER, Types.list(A)); - } - - @Override - public Type applyExact(MethodBuilder mb, Val[] parameters) { - parameters[0].push(mb); - mb.invokeInterface("java/util/List", "size", TypeDesc.INT, Constants.EMPTY_TYPEDESC_ARRAY); - return getReturnType(); - } - - @Override - public String toString() { - return "length"; - } -} +package org.simantics.scl.compiler.constants.singletons; + +import org.cojen.classfile.TypeDesc; +import org.simantics.scl.compiler.constants.FunctionValue; +import org.simantics.scl.compiler.internal.codegen.references.Val; +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; +import org.simantics.scl.compiler.types.Types; +import org.simantics.scl.compiler.types.kinds.Kinds; + +public class ListLength extends FunctionValue { + private static TVar A = Types.var(Kinds.STAR); + public static final ListLength INSTANCE = new ListLength(); + + private ListLength() { + super(new TVar[] {A}, Types.NO_EFFECTS, Types.INTEGER, Types.list(A)); + } + + @Override + public Type applyExact(MethodBuilder mb, Val[] parameters) { + parameters[0].push(mb); + mb.invokeInterface("java/util/List", "size", TypeDesc.INT, Constants.EMPTY_TYPEDESC_ARRAY); + return getReturnType(); + } + + @Override + public String toString() { + return "length"; + } +}