本文整理汇总了Java中jdk.nashorn.internal.codegen.types.Type.NUMBER属性的典型用法代码示例。如果您正苦于以下问题:Java Type.NUMBER属性的具体用法?Java Type.NUMBER怎么用?Java Type.NUMBER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类jdk.nashorn.internal.codegen.types.Type
的用法示例。
在下文中一共展示了Type.NUMBER属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTypeForSlotDescriptor
static Type getTypeForSlotDescriptor(final char typeDesc) {
// Recognizing both lowercase and uppercase as we're using both to signify symbol boundaries; see
// MethodEmitter.markSymbolBoundariesInLvarTypesDescriptor().
switch (typeDesc) {
case 'I':
case 'i':
return Type.INT;
case 'J':
case 'j':
return Type.LONG;
case 'D':
case 'd':
return Type.NUMBER;
case 'A':
case 'a':
return Type.OBJECT;
case 'U':
case 'u':
return Type.UNKNOWN;
default:
throw new AssertionError();
}
}
示例2: presetsMatchElementType
private boolean presetsMatchElementType() {
if (elementType == Type.INT) {
return presets instanceof int[];
} else if (elementType == Type.LONG) {
return presets instanceof long[];
} else if (elementType == Type.NUMBER) {
return presets instanceof double[];
} else {
return presets instanceof Object[];
}
}
示例3: ensureInt
@SuppressWarnings("unused")
private static int ensureInt(final double arg, final int programPoint) {
if (JSType.isStrictlyRepresentableAsInt(arg)) {
return (int)arg;
}
throw new UnwarrantedOptimismException(arg, programPoint, Type.NUMBER);
}
示例4: presetsMatchElementType
private boolean presetsMatchElementType() {
if (elementType == Type.INT) {
return presets instanceof int[];
} else if (elementType == Type.NUMBER) {
return presets instanceof double[];
} else {
return presets instanceof Object[];
}
}
示例5: undefinedToNumber
private static Type undefinedToNumber(final Type type) {
return type == Type.UNDEFINED ? Type.NUMBER : type;
}
示例6: undefinedToNumber
private static final Type undefinedToNumber(final Type type) {
return type == Type.UNDEFINED ? Type.NUMBER : type;
}
示例7: objectToNumber
private static Type objectToNumber(final Type t) {
return t.isObject() ? Type.NUMBER : t;
}
示例8: createNarrowest
/**
* Create an {@code UnwarrantedOptimismException} with the given return value and program point, narrowing
* the type to {@code number} if the value is a float or a long that can be represented as double.
*
* @param returnValue the return value
* @param programPoint the program point
* @return the exception
*/
public static UnwarrantedOptimismException createNarrowest(final Object returnValue, final int programPoint) {
if (returnValue instanceof Float
|| (returnValue instanceof Long && JSType.isRepresentableAsDouble((Long) returnValue))) {
return new UnwarrantedOptimismException(((Number) returnValue).doubleValue(), programPoint, Type.NUMBER);
}
return new UnwarrantedOptimismException(returnValue, programPoint);
}