本文整理匯總了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);
}