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


Java Type.CHARSEQUENCE属性代码示例

本文整理汇总了Java中jdk.nashorn.internal.codegen.types.Type.CHARSEQUENCE属性的典型用法代码示例。如果您正苦于以下问题:Java Type.CHARSEQUENCE属性的具体用法?Java Type.CHARSEQUENCE怎么用?Java Type.CHARSEQUENCE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在jdk.nashorn.internal.codegen.types.Type的用法示例。


在下文中一共展示了Type.CHARSEQUENCE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decideType

private static Type decideType(final Type lhsType, final Type rhsType) {
    // Compare this to getWidestOperationType() for ADD and ASSIGN_ADD cases. There's some similar logic, but these
    // are optimistic decisions, meaning that we don't have to treat boolean addition separately (as it'll become
    // int addition in the general case anyway), and that we also don't conservatively widen sums of ints to
    // longs, or sums of longs to doubles.
    if(isString(lhsType) || isString(rhsType)) {
        return Type.CHARSEQUENCE;
    }
    // NOTE: We don't have optimistic object-to-(int, long) conversions. Therefore, if any operand is an Object, we
    // bail out of optimism here and presume a conservative Object return value, as the object's ToPrimitive() can
    // end up returning either a number or a string, and their common supertype is Object, for better or worse.
    final Type widest = Type.widest(undefinedToNumber(booleanToInt(lhsType)), undefinedToNumber(booleanToInt(rhsType)));
    return widest.isObject() ? Type.OBJECT : widest;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:BinaryNode.java

示例2: isString

private static boolean isString(final Type type) {
    return type == Type.STRING || type == Type.CHARSEQUENCE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:3,代码来源:BinaryNode.java


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