本文整理汇总了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;
}
示例2: isString
private static boolean isString(final Type type) {
return type == Type.STRING || type == Type.CHARSEQUENCE;
}