public class LangPrimType extends PrimType implements TypeValue, HasOwningField
Type.NeverReturns
Modifier and Type | Field and Description |
---|---|
static PrimType |
byteType |
static LangPrimType |
characterOrEofType |
static LangPrimType |
characterType |
static LangPrimType |
charType |
static PrimType |
doubleType |
static PrimType |
floatType |
static PrimType |
intType |
static LangPrimType |
isTrueType
Special type used for boolean-valued guard expressions in patterns.
|
static PrimType |
longType |
static PrimType |
shortType |
static LangPrimType |
stringCursorType |
static LangPrimType |
unsignedByteType |
static LangPrimType |
unsignedIntType |
static LangPrimType |
unsignedLongType |
static LangPrimType |
unsignedShortType |
static PrimType |
voidType |
boolean_ctype, boolean_type, booleanType, booleanValue_method, byte_type, char_type, clone_method, double_type, doubleValue_method, errorType, float_type, floatValue_method, int_type, intValue_method, java_lang_Class_type, javalangannotationAnnotationType, javalangBooleanType, javalangCharacterType, javalangClassType, javalanginvokeMethodHandleType, javalangNumberType, javalangObjectType, javalangStringType, javalangThrowableType, long_type, longValue_method, neverReturnsType, nullType, number_type, objectType, pointer_type, reflectClass, short_type, string_type, throwable_type, toString_method, tostring_type, toStringType, typeArray0, void_type
Constructor and Description |
---|
LangPrimType(PrimType type) |
LangPrimType(PrimType type,
Language language) |
LangPrimType(java.lang.String nam,
java.lang.String sig,
int siz,
java.lang.Class reflectClass) |
LangPrimType(java.lang.String nam,
java.lang.String sig,
int siz,
java.lang.Class reflectClass,
Language language) |
Modifier and Type | Method and Description |
---|---|
ClassType |
boxedType() |
char |
charValue(java.lang.Object value)
Coerce value to a char.
|
java.lang.Object |
coerceFromObject(java.lang.Object obj)
Convert an object to a value of this Type.
|
java.lang.Object |
coerceToObject(java.lang.Object obj)
Given a raw JVM value convert it to an object of this type.
|
int |
compare(Type other)
Return a numeric code showing "subtype" relationship:
1: if other is a pure subtype of this;
0: if has the same values;
-1: if this is a pure subtype of other;
-2: if they have values in common but neither is a subtype of the other;
-3: if the types have no values in common.
|
static java.lang.Object |
convertIntegerLiteral(IntNum ivalue,
PrimType type,
boolean nativeValue) |
java.lang.Object |
convertToRaw(java.lang.Object obj) |
Expression |
convertValue(Expression value)
Return converted expression or null.
|
void |
emitCoerceFromObject(CodeAttr code)
Compile code to coerce/convert from Object to this type.
|
void |
emitCoerceToObject(CodeAttr code)
Compile code to convert a object of this type on the stack to Object.
|
void |
emitIsInstance(CodeAttr code) |
void |
emitIsInstance(Variable incoming,
Compilation comp,
Target target)
Emit code for incoming instanceof this_type.
|
void |
emitTestIf(Variable incoming,
Declaration decl,
Compilation comp)
Emit code for
if (incoming instanceof this_type) decl = incoming ....
|
static void |
emitTestIfNumber(Variable incoming,
Declaration decl,
Type type,
Compilation comp) |
java.lang.String |
encodeType(Language language) |
Procedure |
getConstructor()
Get the constructor function for this type.
|
Type |
getImplementationType()
Return Java-level implementation type.
|
Field |
getOwningField()
If non-null a field that has this value.
|
int |
isCompatibleWithValue(Type valueType)
If this is the target type, is a given source type compatible?
|
boolean |
isUnsigned() |
booleanValue, compare, promotedType, unboxedType
emitConvertFromPrimitive, getGenericSignature, getMaybeGenericSignature, getName, getRawType, getRealType, getReflectClass, getSignature, getSize, getSizeInWords, getType, hashCode, isCompatibleWithValue, isExisting, isInstance, isInterface, isMoreSpecific, isSame, isSubtype, isValidJavaTypeName, isVoid, lookupType, lowestCommonSharedType, lowestCommonSuperType, make, make, printSignature, promote, promoteIfUnsigned, registerTypeForClass, setGenericSignature, setName, setReflectClass, setSignature, signatureLength, signatureLength, signatureToName, signatureToPrimitive, signatureToType, signatureToType, swappedCompareResult, toString
public static final PrimType byteType
public static final PrimType shortType
public static final PrimType intType
public static final PrimType longType
public static final PrimType floatType
public static final PrimType doubleType
public static final LangPrimType charType
public static final PrimType voidType
public static final LangPrimType characterType
public static final LangPrimType characterOrEofType
public static final LangPrimType unsignedLongType
public static final LangPrimType unsignedIntType
public static final LangPrimType unsignedShortType
public static final LangPrimType unsignedByteType
public static final LangPrimType stringCursorType
public static final LangPrimType isTrueType
public LangPrimType(PrimType type)
public LangPrimType(java.lang.String nam, java.lang.String sig, int siz, java.lang.Class reflectClass)
public LangPrimType(java.lang.String nam, java.lang.String sig, int siz, java.lang.Class reflectClass, Language language)
public Type getImplementationType()
Type
getImplementationType
in interface TypeValue
getImplementationType
in class Type
public Field getOwningField()
HasOwningField
getOwningField
in interface HasOwningField
public boolean isUnsigned()
isUnsigned
in class PrimType
public java.lang.Object coerceFromObject(java.lang.Object obj)
Type
coerceFromObject
in class PrimType
public char charValue(java.lang.Object value)
PrimType
public void emitIsInstance(CodeAttr code)
emitIsInstance
in class PrimType
public void emitCoerceFromObject(CodeAttr code)
Type
emitCoerceFromObject
in class PrimType
public java.lang.Object coerceToObject(java.lang.Object obj)
Type
getRawType()
, boxed as needed. The result may be
a language-specific (boxed) value. Generally a no-op.coerceToObject
in class Type
public java.lang.Object convertToRaw(java.lang.Object obj)
convertToRaw
in class PrimType
public void emitCoerceToObject(CodeAttr code)
Type
emitCoerceToObject
in class PrimType
public int compare(Type other)
Type
public int isCompatibleWithValue(Type valueType)
Type
isCompatibleWithValue
in class Type
public static void emitTestIfNumber(Variable incoming, Declaration decl, Type type, Compilation comp)
public void emitTestIf(Variable incoming, Declaration decl, Compilation comp)
TypeValue
emitTestIf
in interface TypeValue
incoming
- Contains the value we are testing to see if it has the
type of this. If null, use top-of-stack.
May not be null if decl is non-null.decl
- If non-null, assign value after coercion to Declaration.comp
- The compilation state.public Expression convertValue(Expression value)
TypeValue
convertValue
in interface TypeValue
public void emitIsInstance(Variable incoming, Compilation comp, Target target)
TypeValue
InstanceOf
.emitIsInstance
which is a conveniece method that calls
emitTestIf
.emitIsInstance
in interface TypeValue
incoming
- Contains the value we are testing to see if it has the
the type of 'this'. If null, use top-of-stack.comp
- The compilation state.target
- Where to leave the result.public Procedure getConstructor()
TypeValue
<init>
methods) should be used.getConstructor
in interface TypeValue
public static java.lang.Object convertIntegerLiteral(IntNum ivalue, PrimType type, boolean nativeValue)
public java.lang.String encodeType(Language language)
encodeType
in interface TypeValue