当前位置: 首页>>代码示例>>Java>>正文


Java Type.NUMBER属性代码示例

本文整理汇总了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();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:CodeGeneratorLexicalContext.java

示例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[];
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:LiteralNode.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:OptimisticReturnFilters.java

示例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[];
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:LiteralNode.java

示例5: undefinedToNumber

private static Type undefinedToNumber(final Type type) {
    return type == Type.UNDEFINED ? Type.NUMBER : type;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:3,代码来源:BinaryNode.java

示例6: undefinedToNumber

private static final Type undefinedToNumber(final Type type) {
    return type == Type.UNDEFINED ? Type.NUMBER : type;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:3,代码来源:CodeGenerator.java

示例7: objectToNumber

private static Type objectToNumber(final Type t) {
    return t.isObject() ? Type.NUMBER : t;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:3,代码来源:CodeGenerator.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:UnwarrantedOptimismException.java


注:本文中的jdk.nashorn.internal.codegen.types.Type.NUMBER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。