Class ArrayType

All Implemented Interfaces:
AnyType

public class ArrayType extends TypeManager.StructType
A reference to an array type
  • Field Details

    • arrayType

      private AnyType arrayType
    • nativeArrayType

      private AnyType nativeArrayType
    • nativeFieldName

      private NamedStorageType nativeFieldName
    • componentClassIndex

      private int componentClassIndex
  • Constructor Details

    • ArrayType

      public ArrayType(AnyType arrayType, @Nonnull TypeManager manager, int componentClassIndex, WasmOptions options)
      Create a new array type
      Parameters:
      arrayType - the type of the array
      manager - the manager which hold all StructTypes
      componentClassIndex - the running index of the component/array class/type
      options - compiler properties
    • ArrayType

      private ArrayType(@Nonnull String name, @Nonnull TypeManager.StructTypeKind kind, @Nonnull TypeManager manager, AnyType arrayType)
      Create a new instance
      Parameters:
      name - the type name
      kind - the kind, array or array_native
      manager - the manager which hold all StructTypes
      arrayType - the type of the array
  • Method Details

    • getJavaClassName

      @Nonnull private static String getJavaClassName(AnyType arrayType)
      Create class name for the array class.
      Parameters:
      arrayType - the type of the array
      Returns:
      the name
    • getArrayType

      public AnyType getArrayType()
      The element type of the array
      Returns:
      the type
    • getNativeArrayType

      public AnyType getNativeArrayType()
      The native webassembly array type that we wrap
      Returns:
      the type
    • getNativeFieldName

      public NamedStorageType getNativeFieldName()
      The native field name
      Returns:
      the field name
    • getComponentClassIndex

      protected int getComponentClassIndex()
      The running index of the component/array class/type for class meta data, instanceof and interface calls.
      Overrides:
      getComponentClassIndex in class TypeManager.StructType
      Returns:
      the unique index or -1 id not an array
    • isRefType

      public boolean isRefType()
      If the type is a reference type. A GC reference to the heap.
      Specified by:
      isRefType in interface AnyType
      Overrides:
      isRefType in class TypeManager.StructType
      Returns:
      true, is GC type
    • isSubTypeOf

      public boolean isSubTypeOf(AnyType type)
      Check if this is a sub type of given type.
      Specified by:
      isSubTypeOf in interface AnyType
      Overrides:
      isSubTypeOf in class TypeManager.StructType
      Parameters:
      type - type to check
      Returns:
      true, if both are identical or this is a sub type of other. Or if other is a parent type of this.