本文整理汇总了Java中jdk.nashorn.internal.ir.BinaryNode类的典型用法代码示例。如果您正苦于以下问题:Java BinaryNode类的具体用法?Java BinaryNode怎么用?Java BinaryNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BinaryNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了BinaryNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertArrowFunctionParameterList
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private List<IdentNode> convertArrowFunctionParameterList(final Expression paramListExpr, final int functionLine) {
final List<IdentNode> parameters;
if (paramListExpr == null) {
// empty parameter list, i.e. () =>
parameters = Collections.emptyList();
} else if (paramListExpr instanceof IdentNode || paramListExpr.isTokenType(ASSIGN) || isDestructuringLhs(paramListExpr)) {
parameters = Collections.singletonList(verifyArrowParameter(paramListExpr, 0, functionLine));
} else if (paramListExpr instanceof BinaryNode && Token.descType(paramListExpr.getToken()) == COMMARIGHT) {
parameters = new ArrayList<>();
Expression car = paramListExpr;
do {
final Expression cdr = ((BinaryNode) car).rhs();
parameters.add(0, verifyArrowParameter(cdr, parameters.size(), functionLine));
car = ((BinaryNode) car).lhs();
} while (car instanceof BinaryNode && Token.descType(car.getToken()) == COMMARIGHT);
parameters.add(0, verifyArrowParameter(car, parameters.size(), functionLine));
} else {
throw error(AbstractParser.message("expected.arrow.parameter"), paramListExpr.getToken());
}
return parameters;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:Parser.java
示例2: loadASSIGN
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadASSIGN(final BinaryNode binaryNode) {
final Expression lhs = binaryNode.lhs();
final Expression rhs = binaryNode.rhs();
final Type rhsType = rhs.getType();
// Detect dead assignments
if(lhs instanceof IdentNode) {
final Symbol symbol = ((IdentNode)lhs).getSymbol();
if(!symbol.isScope() && !symbol.hasSlotFor(rhsType) && lc.getCurrentDiscard() == binaryNode) {
loadAndDiscard(rhs);
lc.popDiscard();
method.markDeadLocalVariable(symbol);
return;
}
}
new Store<BinaryNode>(binaryNode, lhs) {
@Override
protected void evaluate() {
// NOTE: we're loading with "at least as wide as" so optimistic operations on the right hand side
// remain optimistic, and then explicitly convert to the required type if needed.
loadExpressionAsType(rhs, rhsType);
}
}.store();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:CodeGenerator.java
示例3: AssignmentTreeImpl
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
AssignmentTreeImpl(final BinaryNode node, final ExpressionTree left, final ExpressionTree right) {
super(node);
assert node.isAssignment() : "assignment node expected";
this.var = left;
this.expr = right;
this.kind = getOperator(node.tokenType());
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:AssignmentTreeImpl.java
示例4: loadASSIGN_DIV
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadASSIGN_DIV(final BinaryNode binaryNode) {
new BinaryOptimisticSelfAssignment(binaryNode) {
@Override
protected void op(final OptimisticOperation oo) {
method.div(oo.getProgramPoint());
}
}.store();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:CodeGenerator.java
示例5: loadASSIGN_BIT_XOR
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadASSIGN_BIT_XOR(final BinaryNode binaryNode) {
new BinarySelfAssignment(binaryNode) {
@Override
protected void op() {
method.xor();
}
}.store();
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:CodeGenerator.java
示例6: loadBIT_OR
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadBIT_OR(final BinaryNode binaryNode) {
// Optimize x|0 to (int)x
if (isRhsZero(binaryNode)) {
loadExpressionAsType(binaryNode.lhs(), Type.INT);
} else {
loadBinaryOperands(binaryNode);
method.or();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:CodeGenerator.java
示例7: enterBinaryNode
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
@Override
public boolean enterBinaryNode(final BinaryNode binaryNode) {
if (binaryNode.isTokenType(ASSIGN)) {
binaryNode.lhs().accept(this);
// Initializer(rhs) can be any AssignmentExpression
return false;
} else {
return enterDefault(binaryNode);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Parser.java
示例8: loadASSIGN_ADD
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadASSIGN_ADD(final BinaryNode binaryNode) {
new BinaryOptimisticSelfAssignment(binaryNode) {
@Override
protected void op(final OptimisticOperation oo) {
assert !(binaryNode.getType().isObject() && oo.isOptimistic);
method.add(oo.getProgramPoint());
}
}.store();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:CodeGenerator.java
示例9: isEvalResultAssignment
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
/**
* Is this an assignment to the special variable that hosts scripting eval
* results, i.e. __return__?
*
* @param expression expression to check whether it is $evalresult = X
* @return true if an assignment to eval result, false otherwise
*/
private static boolean isEvalResultAssignment(final Node expression) {
final Node e = expression;
if (e instanceof BinaryNode) {
final Node lhs = ((BinaryNode)e).lhs();
if (lhs instanceof IdentNode) {
return ((IdentNode)lhs).getName().equals(RETURN.symbolName());
}
}
return false;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Lower.java
示例10: loadMOD
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadMOD(final BinaryNode binaryNode, final TypeBounds resultBounds) {
new BinaryArith() {
@Override
protected void op(final int programPoint) {
method.rem(programPoint);
}
}.evaluate(binaryNode, resultBounds);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:CodeGenerator.java
示例11: loadSUB
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadSUB(final BinaryNode binaryNode, final TypeBounds resultBounds) {
new BinaryArith() {
@Override
protected void op(final int programPoint) {
method.sub(programPoint);
}
}.evaluate(binaryNode, resultBounds);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:CodeGenerator.java
示例12: loadDIV
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadDIV(final BinaryNode binaryNode, final TypeBounds resultBounds) {
new BinaryArith() {
@Override
protected void op(final int programPoint) {
method.div(programPoint);
}
}.evaluate(binaryNode, resultBounds);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:CodeGenerator.java
示例13: leaveBinaryNode
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
@Override
public Node leaveBinaryNode(final BinaryNode binaryNode) {
if (binaryNode.isAssignment() && binaryNode.lhs() instanceof IdentNode) {
checkConstAssignment((IdentNode) binaryNode.lhs());
}
switch (binaryNode.tokenType()) {
case ASSIGN:
return leaveASSIGN(binaryNode);
default:
return super.leaveBinaryNode(binaryNode);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:AssignSymbols.java
示例14: leaveEQ_STRICT
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
@Override
public Node leaveEQ_STRICT(final BinaryNode binaryNode) {
return compareWeight(binaryNode);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:WeighNodes.java
示例15: enqueueChildren
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private static void enqueueChildren(final Node node, final Class<?> nodeClass, final List<Field> children) {
final Deque<Class<?>> stack = new ArrayDeque<>();
/**
* Here is some ugliness that can be overcome by proper ChildNode annotations
* with proper orders. Right now we basically sort all classes up to Node
* with super class first, as this often is the natural order, e.g. base
* before index for an IndexNode.
*
* Also there are special cases as this is not true for UnaryNodes(lhs) and
* BinaryNodes extends UnaryNode (with lhs), and TernaryNodes.
*
* TODO - generalize traversal with an order built on annotations and this
* will go away.
*/
Class<?> clazz = nodeClass;
do {
stack.push(clazz);
clazz = clazz.getSuperclass();
} while (clazz != null);
if (node instanceof TernaryNode) {
// HACK juggle "third"
stack.push(stack.removeLast());
}
// HACK change operator order for BinaryNodes to get lhs first.
final Iterator<Class<?>> iter = node instanceof BinaryNode ? stack.descendingIterator() : stack.iterator();
while (iter.hasNext()) {
final Class<?> c = iter.next();
for (final Field f : c.getDeclaredFields()) {
try {
f.setAccessible(true);
final Object child = f.get(node);
if (child == null) {
continue;
}
if (child instanceof Node) {
children.add(f);
} else if (child instanceof Collection) {
if (!((Collection<?>)child).isEmpty()) {
children.add(f);
}
}
} catch (final IllegalArgumentException | IllegalAccessException e) {
return;
}
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:52,代码来源:ASTWriter.java
示例16: leaveBIND
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
@Override
public Node leaveBIND(final BinaryNode binaryNode) {
return binaryNodeWeight(binaryNode);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:WeighNodes.java
示例17: leaveASSIGN_BIT_OR
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
@Override
public Node leaveASSIGN_BIT_OR(final BinaryNode binaryNode) {
return binaryNodeWeight(binaryNode);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:WeighNodes.java
示例18: leaveASSIGN
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
@Override
public Node leaveASSIGN(final BinaryNode binaryNode) {
return binaryNodeWeight(binaryNode);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:WeighNodes.java
示例19: leaveOR
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
@Override
public Node leaveOR(final BinaryNode binaryNode) {
return binaryNodeWeight(binaryNode);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:WeighNodes.java
示例20: loadSAR
import jdk.nashorn.internal.ir.BinaryNode; //导入依赖的package包/类
private void loadSAR(final BinaryNode binaryNode) {
loadBinaryOperands(binaryNode);
method.sar();
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:CodeGenerator.java
注:本文中的jdk.nashorn.internal.ir.BinaryNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论