本文整理汇总了Java中jdk.nashorn.internal.ir.Assignment类的典型用法代码示例。如果您正苦于以下问题:Java Assignment类的具体用法?Java Assignment怎么用?Java Assignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Assignment类属于jdk.nashorn.internal.ir包,在下文中一共展示了Assignment类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: specialize
import jdk.nashorn.internal.ir.Assignment; //导入依赖的package包/类
<T extends Expression> SpecializedNode specialize(final Assignment<T> assignment) {
final Node node = ((Node)assignment);
final T lhs = assignment.getAssignmentDest();
final Expression rhs = assignment.getAssignmentSource();
if (!canHaveCallSiteType(lhs)) {
return new SpecializedNode(node, null);
}
final Type to;
if (node.isSelfModifying()) {
to = node.getWidestOperationType();
} else {
to = rhs.getType();
}
if (!isSupportedCallSiteType(to)) {
//meaningless to specialize to boolean or object
return new SpecializedNode(node, null);
}
final Node newNode = assignment.setAssignmentDest(setTypeOverride(lhs, to));
final Node typePropagatedNode;
if(newNode instanceof Expression) {
typePropagatedNode = propagateType((Expression)newNode, to);
} else if(newNode instanceof VarNode) {
// VarNode, being a statement, doesn't have its own symbol; it uses the symbol of its name instead.
final VarNode varNode = (VarNode)newNode;
typePropagatedNode = varNode.setName((IdentNode)propagateType(varNode.getName(), to));
} else {
throw new AssertionError();
}
return new SpecializedNode(typePropagatedNode, to);
}