本文整理汇总了Java中jdk.nashorn.internal.ir.AccessNode类的典型用法代码示例。如果您正苦于以下问题:Java AccessNode类的具体用法?Java AccessNode怎么用?Java AccessNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了AccessNode类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enterAccessNode
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
@Override
public boolean enterAccessNode(final AccessNode accessNode) {
enterDefault(accessNode);
type("MemberExpression");
comma();
property("object");
accessNode.getBase().accept(this);
comma();
property("property", accessNode.getProperty());
comma();
property("computed", false);
return leave();
}
示例2: evaluateSafely
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
private Object evaluateSafely(final Expression expr) {
if (expr instanceof IdentNode) {
return runtimeScope == null ? null : evaluatePropertySafely(runtimeScope, ((IdentNode)expr).getName());
}
if (expr instanceof AccessNode) {
final AccessNode accessNode = (AccessNode)expr;
final Object base = evaluateSafely(accessNode.getBase());
if (!(base instanceof ScriptObject)) {
return null;
}
return evaluatePropertySafely((ScriptObject)base, accessNode.getProperty());
}
return null;
}
示例3: checkValidLValue
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的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;
}
}
示例4: enterAccessNode
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
@Override
public boolean enterAccessNode(final AccessNode accessNode) {
enterDefault(accessNode);
type("MemberExpression");
comma();
property("object");
accessNode.getBase().accept(this);
comma();
property("property");
accessNode.getProperty().accept(this);
comma();
property("computed", false);
return leave();
}
示例5: leaveASSIGN
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
@Override
public Node leaveASSIGN(final BinaryNode binaryNode) {
final SpecializedNode specialized = specialize(binaryNode);
final BinaryNode specBinaryNode = (BinaryNode)specialized.node;
Type destType = specialized.type;
if (destType == null) {
destType = specBinaryNode.getType();
}
// Register assignments to this object in case this is used as constructor
if (binaryNode.lhs() instanceof AccessNode) {
AccessNode accessNode = (AccessNode) binaryNode.lhs();
if (accessNode.getBase().getSymbol().isThis()) {
lc.getCurrentFunction().addThisProperty(accessNode.getProperty().getName());
}
}
return specBinaryNode.setRHS(convert(specBinaryNode.rhs(), destType));
}
示例6: getDefaultFunctionName
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
private String getDefaultFunctionName() {
if(!defaultNames.isEmpty()) {
final Object nameExpr = defaultNames.peek();
if(nameExpr instanceof PropertyKey) {
markDefaultNameUsed();
return ((PropertyKey)nameExpr).getPropertyName();
} else if(nameExpr instanceof AccessNode) {
markDefaultNameUsed();
return ((AccessNode)nameExpr).getProperty();
}
}
return null;
}
示例7: leaveASSIGN
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
private Node leaveASSIGN(final BinaryNode binaryNode) {
// If we're assigning a property of the this object ("this.foo = ..."), record it.
final Expression lhs = binaryNode.lhs();
if (lhs instanceof AccessNode) {
final AccessNode accessNode = (AccessNode) lhs;
final Expression base = accessNode.getBase();
if (base instanceof IdentNode) {
final Symbol symbol = ((IdentNode)base).getSymbol();
if(symbol.isThis()) {
thisProperties.peek().add(accessNode.getProperty());
}
}
}
return binaryNode;
}
示例8: getDefaultFunctionName
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
private String getDefaultFunctionName() {
if (!defaultNames.isEmpty()) {
final Object nameExpr = defaultNames.peek();
if (nameExpr instanceof PropertyKey) {
markDefaultNameUsed();
return ((PropertyKey)nameExpr).getPropertyName();
} else if (nameExpr instanceof AccessNode) {
markDefaultNameUsed();
return ((AccessNode)nameExpr).getProperty();
}
}
return null;
}
示例9: leaveASSIGN
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
private Node leaveASSIGN(final BinaryNode binaryNode) {
// If we're assigning a property of the this object ("this.foo = ..."), record it.
final Expression lhs = binaryNode.lhs();
if (lhs instanceof AccessNode) {
final AccessNode accessNode = (AccessNode) lhs;
final Expression base = accessNode.getBase();
if (base instanceof IdentNode) {
final Symbol symbol = ((IdentNode) base).getSymbol();
if (symbol.isThis()) {
thisProperties.peek().add(accessNode.getProperty());
}
}
}
return binaryNode;
}
示例10: verifyAssignment
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的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);
}
示例11: leaveAccessNode
import jdk.nashorn.internal.ir.AccessNode; //导入依赖的package包/类
@Override
public Node leaveAccessNode(final AccessNode accessNode) {
//While Object type is assigned here, Access Specialization in FinalizeTypes may narrow this, that
//is why we can't set the access node base to be an object here, that will ruin access specialization
//for example for a.x | 17.
return end(ensureSymbol(Type.OBJECT, accessNode));
}