Class TypeReference
A reference to a type appearing in a class, field or method declaration, or on an instruction. Such a reference designates the part of the class where the referenced type is appearing (e.g. an 'extends', 'implements' or 'throws' clause, a 'new' instruction, a 'catch' clause, a type cast, a local variable declaration, etc).
🏭 Constructors
constructor
TypeReference(typeRef: number): TypeReferenceCreates a new TypeReference.
Parameters
- typeRef:
numberthe int encoded value of the type reference, as received in a visit method related to type annotations, like visitTypeAnnotation.
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:186
🏷️ Properties
CAST static readonly
CAST: number = 71The sort of type references that target the type declared in an explicit or implicit cast instruction. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:147
CLASS_EXTENDS static readonly
CLASS_EXTENDS: number = 16The sort of type references that target the super class of a class or one of the interfaces it implements. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:57
CLASS_TYPE_PARAMETER static readonly
CLASS_TYPE_PARAMETER: number = 0The sort of type references that target a type parameter of a generic class. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:45
CLASS_TYPE_PARAMETER_BOUND static readonly
CLASS_TYPE_PARAMETER_BOUND: number = 17The sort of type references that target a bound of a type parameter of a generic class. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:63
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT static readonly
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: number = 72The sort of type references that target a type parameter of a generic constructor in a constructor call. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:153
CONSTRUCTOR_REFERENCE static readonly
CONSTRUCTOR_REFERENCE: number = 69The sort of type references that target the receiver type of a constructor reference. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:135
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT static readonly
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT: number = 74The sort of type references that target a type parameter of a generic constructor in a constructor reference. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:165
EXCEPTION_PARAMETER static readonly
EXCEPTION_PARAMETER: number = 66The sort of type references that target the type of the exception of a 'catch' clause in a method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:117
FIELD static readonly
FIELD: number = 19The sort of type references that target the type of a field. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:75
INSTANCEOF static readonly
INSTANCEOF: number = 67The sort of type references that target the type declared in an 'instanceof' instruction. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:123
LOCAL_VARIABLE static readonly
LOCAL_VARIABLE: number = 64The sort of type references that target the type of a local variable in a method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:105
METHOD_FORMAL_PARAMETER static readonly
METHOD_FORMAL_PARAMETER: number = 22The sort of type references that target the type of a formal parameter of a method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:93
METHOD_INVOCATION_TYPE_ARGUMENT static readonly
METHOD_INVOCATION_TYPE_ARGUMENT: number = 73The sort of type references that target a type parameter of a generic method in a method call. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:159
METHOD_RECEIVER static readonly
METHOD_RECEIVER: number = 21The sort of type references that target the receiver type of a method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:87
METHOD_REFERENCE static readonly
METHOD_REFERENCE: number = 70The sort of type references that target the receiver type of a method reference. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:141
METHOD_REFERENCE_TYPE_ARGUMENT static readonly
METHOD_REFERENCE_TYPE_ARGUMENT: number = 75The sort of type references that target a type parameter of a generic method in a method reference. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:171
METHOD_RETURN static readonly
METHOD_RETURN: number = 20The sort of type references that target the return type of a method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:81
METHOD_TYPE_PARAMETER static readonly
METHOD_TYPE_PARAMETER: number = 1The sort of type references that target a type parameter of a generic method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:51
METHOD_TYPE_PARAMETER_BOUND static readonly
METHOD_TYPE_PARAMETER_BOUND: number = 18The sort of type references that target a bound of a type parameter of a generic method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:69
NEW static readonly
NEW: number = 68The sort of type references that target the type of the object created by a 'new' instruction. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:129
RESOURCE_VARIABLE static readonly
RESOURCE_VARIABLE: number = 65The sort of type references that target the type of a resource variable in a method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:111
THROWS static readonly
THROWS: number = 23The sort of type references that target the type of an exception declared in the throws clause of a method. See [#getSort getSort].
Defined in: packages/asm/libs/TypeReference.ts:99
🔧 Methods
getExceptionIndex
getExceptionIndex(): numberReturns the index of the exception, in a 'throws' clause of a method, whose type is referenced by this type reference. This method must only be used for type references whose sort is [#THROWS THROWS].
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:404
getFormalParameterIndex
getFormalParameterIndex(): numberReturns the index of the formal parameter whose type is referenced by this type reference. This method must only be used for type references whose sort is [#METHOD_FORMAL_PARAMETER METHOD_FORMAL_PARAMETER].
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:393
getSort
getSort(): numberReturns the sort of this type reference.
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:342
getSuperTypeIndex
getSuperTypeIndex(): numberReturns the index of the "super type" of a class that is referenced by this type reference. This method must only be used for type references whose sort is [#CLASS_EXTENDS CLASS_EXTENDS].
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:382
getTryCatchBlockIndex
getTryCatchBlockIndex(): numberReturns the index of the try catch block (using the order in which they are visited with visitTryCatchBlock), whose 'catch' type is referenced by this type reference. This method must only be used for type references whose sort is [#EXCEPTION_PARAMETER EXCEPTION_PARAMETER] .
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:416
getTypeArgumentIndex
getTypeArgumentIndex(): numberReturns the index of the type argument referenced by this type reference. This method must only be used for type references whose sort is [#CAST CAST], [#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT], [#METHOD_INVOCATION_TYPE_ARGUMENT METHOD_INVOCATION_TYPE_ARGUMENT], [#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT], or [#METHOD_REFERENCE_TYPE_ARGUMENT METHOD_REFERENCE_TYPE_ARGUMENT].
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:432
getTypeParameterBoundIndex
getTypeParameterBoundIndex(): numberReturns the index of the type parameter bound, within the type parameter [#getTypeParameterIndex], referenced by this type reference. This method must only be used for type references whose sort is [#CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND] or [#METHOD_TYPE_PARAMETER_BOUND METHOD_TYPE_PARAMETER_BOUND].
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:369
getTypeParameterIndex
getTypeParameterIndex(): numberReturns the index of the type parameter referenced by this type reference. This method must only be used for type references whose sort is [#CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER], [#METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER], [#CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND] or [#METHOD_TYPE_PARAMETER_BOUND METHOD_TYPE_PARAMETER_BOUND].
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:356
getValue
getValue(): numberReturns the int encoded value of this type reference, suitable for use in visit methods related to type annotations, like visitTypeAnnotation.
Return Type
number
Defined in: packages/asm/libs/TypeReference.ts:442
newExceptionReference static
newExceptionReference(exceptionIndex: number): TypeReferenceReturns a reference to the type of an exception, in a 'throws' clause of a method.
Parameters
- exceptionIndex:
numberthe index of an exception in a 'throws' clause of a method.
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:275
newFormalParameterReference static
newFormalParameterReference(paramIndex: number): TypeReferenceReturns a reference to the type of a formal parameter of a method.
Parameters
- paramIndex:
numberthe formal parameter index.
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:262
newSuperTypeReference static
newSuperTypeReference(itfIndex: number): TypeReferenceReturns a reference to the super class or to an interface of the 'implements' clause of a class.
Parameters
- itfIndex:
numberthe index of an interface in the 'implements' clause of a class, or -1 to reference the super class of the class.
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:249
newTryCatchReference static
newTryCatchReference(tryCatchBlockIndex: number): TypeReferenceReturns a reference to the type of the exception declared in a 'catch' clause of a method.
Parameters
- tryCatchBlockIndex:
numberthe index of a try catch block (using the order in which they are visited with visitTryCatchBlock).
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:289
newTypeArgumentReference static
newTypeArgumentReference(sort: number, argIndex: number): TypeReferenceReturns a reference to the type of a type argument in a constructor or method call or reference.
Parameters
- sort:
number[#CAST CAST], [#CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT], [#METHOD_INVOCATION_TYPE_ARGUMENT METHOD_INVOCATION_TYPE_ARGUMENT], [#CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT], or [#METHOD_REFERENCE_TYPE_ARGUMENT METHOD_REFERENCE_TYPE_ARGUMENT]. - argIndex:
numberthe type argument index.
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:312
newTypeParameterBoundReference static
newTypeParameterBoundReference(sort: number, paramIndex: number, boundIndex: number): TypeReferenceReturns a reference to a type parameter bound of a generic class or method.
Parameters
- sort:
number[#CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER] or [#METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER]. - paramIndex:
numberthe type parameter index. - boundIndex:
numberthe type bound index within the above type parameters.
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:236
newTypeParameterReference static
newTypeParameterReference(sort: number, paramIndex: number): TypeReferenceReturns a reference to a type parameter of a generic class or method.
Parameters
- sort:
number[#CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER] or [#METHOD_TYPE_PARAMETER METHOD_TYPE_PARAMETER]. - paramIndex:
numberthe type parameter index.
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:218
newTypeReference static
newTypeReference(sort: number): TypeReferenceReturns a type reference of the given sort.
Parameters
- sort:
number[#FIELD FIELD], [#METHOD_RETURN METHOD_RETURN], [#METHOD_RECEIVER METHOD_RECEIVER], [#LOCAL_VARIABLE LOCAL_VARIABLE], [#RESOURCE_VARIABLE RESOURCE_VARIABLE], [#INSTANCEOF INSTANCEOF], [#NEW NEW], [#CONSTRUCTOR_REFERENCE CONSTRUCTOR_REFERENCE], or [#METHOD_REFERENCE METHOD_REFERENCE].
Return Type
TypeReference
Defined in: packages/asm/libs/TypeReference.ts:204