Java 类jdk.nashorn.internal.ir.AccessNode 实例源码

项目:OpenJSharp    文件:JSONWriter.java   
@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();
}
项目:OpenJSharp    文件:TypeEvaluator.java   
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;
}
项目:openjdk-jdk10    文件:Parser.java   
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;
    }
}
项目:openjdk-jdk10    文件:JSONWriter.java   
@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();
}
项目:openjdk-jdk10    文件:TypeEvaluator.java   
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;
}
项目:openjdk9    文件:Parser.java   
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;
    }
}
项目:openjdk9    文件:JSONWriter.java   
@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();
}
项目:openjdk9    文件:TypeEvaluator.java   
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;
}
项目:kaziranga    文件:JSONWriter.java   
@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();
}
项目:kaziranga    文件:TypeEvaluator.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:JSONWriter.java   
@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();
}
项目:lookaside_java-1.8.0-openjdk    文件:TypeEvaluator.java   
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;
}
项目:jdk8u_nashorn    文件:JSONWriter.java   
@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();
}
项目:jdk8u_nashorn    文件:TypeEvaluator.java   
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;
}
项目:infobip-open-jdk-8    文件:JSONWriter.java   
@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();
}
项目:infobip-open-jdk-8    文件:TypeEvaluator.java   
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;
}
项目:OLD-OpenJDK8    文件:JSONWriter.java   
@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();
}
项目:nashorn-backport    文件:JSONWriter.java   
@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();
}
项目:nashorn-backport    文件:FinalizeTypes.java   
@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));
}
项目:nashorn    文件:JSONWriter.java   
@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();
}
项目:nashorn    文件:FinalizeTypes.java   
@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));
}
项目:OpenJSharp    文件:Parser.java   
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;
}
项目:OpenJSharp    文件:AssignSymbols.java   
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;
}
项目:openjdk-jdk10    文件:Parser.java   
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;
}
项目:openjdk-jdk10    文件:AssignSymbols.java   
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;
}
项目:openjdk9    文件:Parser.java   
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;
}
项目:openjdk9    文件:AssignSymbols.java   
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;
}
项目:kaziranga    文件:Parser.java   
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;
}
项目:kaziranga    文件:AssignSymbols.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:Parser.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:AssignSymbols.java   
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;
}
项目:jdk8u_nashorn    文件:Parser.java   
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;
}
项目:jdk8u_nashorn    文件:AssignSymbols.java   
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;
}
项目:infobip-open-jdk-8    文件:Parser.java   
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;
}
项目:infobip-open-jdk-8    文件:AssignSymbols.java   
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;
}
项目:platypus-js    文件:SymbolsResolver.java   
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;
}
项目:OLD-OpenJDK8    文件:Parser.java   
/**
 * 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);
}
项目:OLD-OpenJDK8    文件:Attr.java   
@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));
}
项目:nashorn-backport    文件:Parser.java   
/**
 * 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);
}
项目:nashorn-backport    文件:Attr.java   
@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));
}