本文整理汇总了Java中jdk.nashorn.internal.codegen.types.NumericType类的典型用法代码示例。如果您正苦于以下问题:Java NumericType类的具体用法?Java NumericType怎么用?Java NumericType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumericType类属于jdk.nashorn.internal.codegen.types包,在下文中一共展示了NumericType类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: popNumeric
import jdk.nashorn.internal.codegen.types.NumericType; //导入依赖的package包/类
/**
* Pop a type from the existing stack, ensuring that it is numeric. Boolean type is popped as int type.
*
* @return the type
*/
private NumericType popNumeric() {
final Type type = popType();
if(type.isBoolean()) {
// Booleans are treated as int for purposes of arithmetic operations
return Type.INT;
}
assert type.isNumeric();
return (NumericType)type;
}
示例2: get2n
import jdk.nashorn.internal.codegen.types.NumericType; //导入依赖的package包/类
/**
* Helper function - expect two types that are numbers and equivalent
*
* @return common type
*/
private NumericType get2n() {
final NumericType p0 = popNumeric();
final NumericType p1 = popNumeric();
assert p0.isEquivalentTo(p1) : "expecting equivalent types on stack but got " + p0 + " and " + p1;
return p0;
}
示例3: popNumeric
import jdk.nashorn.internal.codegen.types.NumericType; //导入依赖的package包/类
/**
* Pop a type from the existing stack, ensuring that it is numeric,
* assert if not
*
* @return the type
*/
private NumericType popNumeric() {
final Type type = stack.pop();
assert type.isNumeric() : type + " is not numeric";
return (NumericType)type;
}