Java Code Examples for jdk.nashorn.internal.codegen.types.Type#CHARSEQUENCE
The following examples show how to use
jdk.nashorn.internal.codegen.types.Type#CHARSEQUENCE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BinaryNode.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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; }
Example 2
Source File: BinaryNode.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; }
Example 3
Source File: BinaryNode.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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; }
Example 4
Source File: BinaryNode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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; }
Example 5
Source File: BinaryNode.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; }
Example 6
Source File: BinaryNode.java From hottub with GNU General Public License v2.0 | 5 votes |
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; }
Example 7
Source File: BinaryNode.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
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; }
Example 8
Source File: BinaryNode.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static boolean isString(final Type type) { return type == Type.STRING || type == Type.CHARSEQUENCE; }
Example 9
Source File: BinaryNode.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static boolean isString(final Type type) { return type == Type.STRING || type == Type.CHARSEQUENCE; }
Example 10
Source File: BinaryNode.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static boolean isString(final Type type) { return type == Type.STRING || type == Type.CHARSEQUENCE; }
Example 11
Source File: BinaryNode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static boolean isString(final Type type) { return type == Type.STRING || type == Type.CHARSEQUENCE; }
Example 12
Source File: BinaryNode.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static boolean isString(final Type type) { return type == Type.STRING || type == Type.CHARSEQUENCE; }
Example 13
Source File: BinaryNode.java From hottub with GNU General Public License v2.0 | 4 votes |
private static boolean isString(final Type type) { return type == Type.STRING || type == Type.CHARSEQUENCE; }
Example 14
Source File: BinaryNode.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
private static boolean isString(final Type type) { return type == Type.STRING || type == Type.CHARSEQUENCE; }