本文整理汇总了Java中jdk.nashorn.internal.ir.IndexNode类的典型用法代码示例。如果您正苦于以下问题:Java IndexNode类的具体用法?Java IndexNode怎么用?Java IndexNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了IndexNode类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: enterIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
enterDefault(indexNode);
type("MemberExpression");
comma();
property("object");
indexNode.getBase().accept(this);
comma();
property("property");
indexNode.getIndex().accept(this);
comma();
property("computed", true);
return leave();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:JSONWriter.java
示例2: checkValidLValue
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
private boolean checkValidLValue(final Expression init, final String contextString) {
if (init instanceof IdentNode) {
if (!checkIdentLValue((IdentNode)init)) {
return false;
}
verifyIdent((IdentNode)init, contextString);
return true;
} else if (init instanceof AccessNode || init instanceof IndexNode) {
return true;
} else if (isDestructuringLhs(init)) {
verifyDestructuringAssignmentPattern(init, contextString);
return true;
} else {
return false;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Parser.java
示例3: leaveIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
final String name = getConstantPropertyName(indexNode.getIndex());
if (name != null) {
// If index node is a constant property name convert index node to access node.
assert Token.descType(indexNode.getToken()) == TokenType.LBRACKET;
return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
}
return super.leaveIndexNode(indexNode);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:Lower.java
示例4: enterIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
curExpr = new ArrayAccessTreeImpl(indexNode,
translateExpr(indexNode.getBase()),
translateExpr(indexNode.getIndex()));
return false;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:IRTranslator.java
示例5: leaveIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
final String name = getConstantPropertyName(indexNode.getIndex());
if (name != null) {
// If index node is a constant property name convert index node to access node.
assert indexNode.isIndex();
return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
}
return super.leaveIndexNode(indexNode);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Lower.java
示例6: verifyAssignment
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
/**
* Verify an assignment expression.
* @param op Operation token.
* @param lhs Left hand side expression.
* @param rhs Right hand side expression.
* @return Verified expression.
*/
private Expression verifyAssignment(final long op, final Expression lhs, final Expression rhs) {
final TokenType opType = Token.descType(op);
switch (opType) {
case ASSIGN:
case ASSIGN_ADD:
case ASSIGN_BIT_AND:
case ASSIGN_BIT_OR:
case ASSIGN_BIT_XOR:
case ASSIGN_DIV:
case ASSIGN_MOD:
case ASSIGN_MUL:
case ASSIGN_SAR:
case ASSIGN_SHL:
case ASSIGN_SHR:
case ASSIGN_SUB:
if (!(lhs instanceof AccessNode ||
lhs instanceof IndexNode ||
lhs instanceof IdentNode)) {
return referenceError(lhs, rhs, env._early_lvalue_error);
}
if (lhs instanceof IdentNode) {
if (!checkIdentLValue((IdentNode)lhs)) {
return referenceError(lhs, rhs, false);
}
verifyStrictIdent((IdentNode)lhs, "assignment");
}
break;
default:
break;
}
// Build up node.
return new BinaryNode(op, lhs, rhs);
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:45,代码来源:Parser.java
示例7: setCanBePrimitive
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
/**
* A symbol (and {@link jdk.nashorn.internal.runtime.Property}) can be tagged as "may be primitive".
* This is used a hint for dual fields that it is even worth it to try representing this
* field as something other than java.lang.Object.
*
* @param node node in which to tag symbols as primitive
* @param to which primitive type to use for tagging
*/
private static void setCanBePrimitive(final Node node, final Type to) {
final HashSet<Node> exclude = new HashSet<>();
node.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
private void setCanBePrimitive(final Symbol symbol) {
LOG.info("*** can be primitive symbol ", symbol, " ", Debug.id(symbol));
symbol.setCanBePrimitive(to);
}
@Override
public boolean enterIdentNode(final IdentNode identNode) {
if (!exclude.contains(identNode)) {
setCanBePrimitive(identNode.getSymbol());
}
return false;
}
@Override
public boolean enterAccessNode(final AccessNode accessNode) {
setCanBePrimitive(accessNode.getProperty().getSymbol());
return false;
}
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
exclude.add(indexNode.getBase()); //prevent array base node to be flagged as primitive, but k in a[k++] is fine
return true;
}
});
}
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:39,代码来源:FinalizeTypes.java
示例8: verifyAssignment
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
/**
* Verify an assignment expression.
* @param op Operation token.
* @param lhs Left hand side expression.
* @param rhs Right hand side expression.
* @return Verified expression.
*/
private Expression verifyAssignment(final long op, final Expression lhs, final Expression rhs) {
final TokenType opType = Token.descType(op);
switch (opType) {
case ASSIGN:
case ASSIGN_ADD:
case ASSIGN_BIT_AND:
case ASSIGN_BIT_OR:
case ASSIGN_BIT_XOR:
case ASSIGN_DIV:
case ASSIGN_MOD:
case ASSIGN_MUL:
case ASSIGN_SAR:
case ASSIGN_SHL:
case ASSIGN_SHR:
case ASSIGN_SUB:
if (!(lhs instanceof AccessNode ||
lhs instanceof IndexNode ||
lhs instanceof IdentNode)) {
return referenceError(lhs, rhs, env._early_lvalue_error);
}
if (lhs instanceof IdentNode) {
if (!checkIdentLValue((IdentNode)lhs)) {
return referenceError(lhs, rhs, false);
}
verifyStrictIdent((IdentNode)lhs, "assignment");
}
break;
default:
break;
}
// Build up node.
if(BinaryNode.isLogical(opType)) {
return new BinaryNode(op, new JoinPredecessorExpression(lhs), new JoinPredecessorExpression(rhs));
}
return new BinaryNode(op, lhs, rhs);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:Parser.java
示例9: leaveIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
return setProgramPoint(indexNode);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:ProgramPoints.java
示例10: enterIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
tagNeverOptimistic(indexNode.getBase());
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:OptimisticTypesCalculator.java
示例11: getOptimisticIgnoreCountForSelfModifyingExpression
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
private static int getOptimisticIgnoreCountForSelfModifyingExpression(final Expression target) {
return target instanceof AccessNode ? 1 : target instanceof IndexNode ? 2 : 0;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:CodeGenerator.java
示例12: leaveIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
weight += ACCESS_WEIGHT;
return indexNode;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:WeighNodes.java
示例13: verifyAssignment
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
/**
* Verify an assignment expression.
* @param op Operation token.
* @param lhs Left hand side expression.
* @param rhs Right hand side expression.
* @return Verified expression.
*/
private Expression verifyAssignment(final long op, final Expression lhs, final Expression rhs) {
final TokenType opType = Token.descType(op);
switch (opType) {
case ASSIGN:
case ASSIGN_ADD:
case ASSIGN_BIT_AND:
case ASSIGN_BIT_OR:
case ASSIGN_BIT_XOR:
case ASSIGN_DIV:
case ASSIGN_MOD:
case ASSIGN_MUL:
case ASSIGN_SAR:
case ASSIGN_SHL:
case ASSIGN_SHR:
case ASSIGN_SUB:
if (lhs instanceof IdentNode) {
if (!checkIdentLValue((IdentNode)lhs)) {
return referenceError(lhs, rhs, false);
}
verifyIdent((IdentNode)lhs, "assignment");
break;
} else if (lhs instanceof AccessNode || lhs instanceof IndexNode) {
break;
} else if (opType == ASSIGN && isDestructuringLhs(lhs)) {
verifyDestructuringAssignmentPattern(lhs, "assignment");
break;
} else {
return referenceError(lhs, rhs, env._early_lvalue_error);
}
default:
break;
}
// Build up node.
if(BinaryNode.isLogical(opType)) {
return new BinaryNode(op, new JoinPredecessorExpression(lhs), new JoinPredecessorExpression(rhs));
}
return new BinaryNode(op, lhs, rhs);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:48,代码来源:Parser.java
示例14: enterIndexNode
import jdk.nashorn.internal.ir.IndexNode; //导入依赖的package包/类
@Override
public boolean enterIndexNode(final IndexNode indexNode) {
visitExpression(indexNode.getBase());
visitExpression(indexNode.getIndex());
return pushExpressionType(indexNode);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:LocalVariableTypesCalculator.java
注:本文中的jdk.nashorn.internal.ir.IndexNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论