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

项目:openjdk-jdk10    文件:WeighNodes.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    weight += OBJECT_WEIGHT;
    final List<PropertyNode> properties = objectNode.getElements();
    final boolean isSpillObject = properties.size() > CodeGenerator.OBJECT_SPILL_THRESHOLD;

    for (final PropertyNode property : properties) {
        if (!LiteralNode.isConstant(property.getValue())) {
            weight += SETPROP_WEIGHT;
            property.getValue().accept(this);
        } else if (!isSpillObject) {
            // constants in spill object are set via preset spill array,
            // but fields objects need to set constants.
            weight += SETPROP_WEIGHT;
        }

    }

    return false;
}
项目:openjdk9    文件:WeighNodes.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    weight += OBJECT_WEIGHT;
    final List<PropertyNode> properties = objectNode.getElements();
    final boolean isSpillObject = properties.size() > CodeGenerator.OBJECT_SPILL_THRESHOLD;

    for (final PropertyNode property : properties) {
        if (!LiteralNode.isConstant(property.getValue())) {
            weight += SETPROP_WEIGHT;
            property.getValue().accept(this);
        } else if (!isSpillObject) {
            // constants in spill object are set via preset spill array,
            // but fields objects need to set constants.
            weight += SETPROP_WEIGHT;
        }

    }

    return false;
}
项目:lookaside_java-1.8.0-openjdk    文件:WeighNodes.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    weight += OBJECT_WEIGHT;
    final List<PropertyNode> properties = objectNode.getElements();
    final boolean isSpillObject = properties.size() > CodeGenerator.OBJECT_SPILL_THRESHOLD;

    for (final PropertyNode property : properties) {
        if (!LiteralNode.isConstant(property.getValue())) {
            weight += SETPROP_WEIGHT;
            property.getValue().accept(this);
        } else if (!isSpillObject) {
            // constants in spill object are set via preset spill array,
            // but fields objects need to set constants.
            weight += SETPROP_WEIGHT;
        }

    }

    return false;
}
项目:jdk8u_nashorn    文件:WeighNodes.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    weight += OBJECT_WEIGHT;
    final List<PropertyNode> properties = objectNode.getElements();
    final boolean isSpillObject = properties.size() > CodeGenerator.OBJECT_SPILL_THRESHOLD;

    for (final PropertyNode property : properties) {
        if (!LiteralNode.isConstant(property.getValue())) {
            weight += SETPROP_WEIGHT;
            property.getValue().accept(this);
        } else if (!isSpillObject) {
            // constants in spill object are set via preset spill array,
            // but fields objects need to set constants.
            weight += SETPROP_WEIGHT;
        }

    }

    return false;
}
项目:OpenJSharp    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:OpenJSharp    文件:CodeGenerator.java   
/**
 * Check if a property value contains a particular program point
 * @param value value
 * @param pp    program point
 * @return true if it's there.
 */
private static boolean propertyValueContains(final Expression value, final int pp) {
    return new Supplier<Boolean>() {
        boolean contains;

        @Override
        public Boolean get() {
            value.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
                @Override
                public boolean enterFunctionNode(final FunctionNode functionNode) {
                    return false;
                }

                @Override
                public boolean enterObjectNode(final ObjectNode objectNode) {
                    return false;
                }

                @Override
                public boolean enterDefault(final Node node) {
                    if (contains) {
                        return false;
                    }
                    if (node instanceof Optimistic && ((Optimistic)node).getProgramPoint() == pp) {
                        contains = true;
                        return false;
                    }
                    return true;
                }
            });

            return contains;
        }
    }.get();
}
项目:openjdk-jdk10    文件:IRTranslator.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    final List<PropertyNode> propNodes = objectNode.getElements();
    final List<? extends PropertyTree> propTrees = translateProperties(propNodes);
    curExpr = new ObjectLiteralTreeImpl(objectNode, propTrees);
    return false;
}
项目:openjdk-jdk10    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:openjdk-jdk10    文件:ReplaceCompileUnits.java   
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
项目:openjdk-jdk10    文件:Lower.java   
@Override
public boolean enterForNode(final ForNode forNode) {
    if (es6 && (forNode.getInit() instanceof ObjectNode || forNode.getInit() instanceof ArrayLiteralNode)) {
        throwNotImplementedYet("es6.destructuring", forNode);
    }
    return super.enterForNode(forNode);
}
项目:openjdk-jdk10    文件:Lower.java   
@Override
public boolean enterASSIGN(BinaryNode binaryNode) {
    if (es6 && (binaryNode.lhs() instanceof ObjectNode || binaryNode.lhs() instanceof ArrayLiteralNode)) {
        throwNotImplementedYet("es6.destructuring", binaryNode);
    }
    return super.enterASSIGN(binaryNode);
}
项目:openjdk-jdk10    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    for(final PropertyNode propertyNode: objectNode.getElements()) {
        // Avoid falsely adding property keys to the control flow graph
        final Expression value = propertyNode.getValue();
        if (value != null) {
            visitExpression(value);
        }
    }
    return pushExpressionType(objectNode);
}
项目:openjdk9    文件:IRTranslator.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    final List<PropertyNode> propNodes = objectNode.getElements();
    final List<PropertyTreeImpl> propTrees = new ArrayList<>(propNodes.size());
    for (final PropertyNode propNode : propNodes) {
        propTrees.add(new PropertyTreeImpl(propNode,
                translateExpr(propNode.getKey()),
                translateExpr(propNode.getValue()),
                (FunctionExpressionTree) translateExpr(propNode.getGetter()),
                (FunctionExpressionTree) translateExpr(propNode.getSetter())));
    }
    curExpr = new ObjectLiteralTreeImpl(objectNode, propTrees);
    return false;
}
项目:openjdk9    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:openjdk9    文件:ReplaceCompileUnits.java   
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
项目:openjdk9    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    for(final PropertyNode propertyNode: objectNode.getElements()) {
        // Avoid falsely adding property keys to the control flow graph
        final Expression value = propertyNode.getValue();
        if (value != null) {
            visitExpression(value);
        }
    }
    return pushExpressionType(objectNode);
}
项目:openjdk9    文件:CodeGenerator.java   
/**
 * Check if a property value contains a particular program point
 * @param value value
 * @param pp    program point
 * @return true if it's there.
 */
private static boolean propertyValueContains(final Expression value, final int pp) {
    return new Supplier<Boolean>() {
        boolean contains;

        @Override
        public Boolean get() {
            value.accept(new SimpleNodeVisitor() {
                @Override
                public boolean enterFunctionNode(final FunctionNode functionNode) {
                    return false;
                }

                @Override
                public boolean enterObjectNode(final ObjectNode objectNode) {
                    return false;
                }

                @Override
                public boolean enterDefault(final Node node) {
                    if (contains) {
                        return false;
                    }
                    if (node instanceof Optimistic && ((Optimistic)node).getProgramPoint() == pp) {
                        contains = true;
                        return false;
                    }
                    return true;
                }
            });

            return contains;
        }
    }.get();
}
项目:kaziranga    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:kaziranga    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    for(final PropertyNode propertyNode: objectNode.getElements()) {
        // Avoid falsely adding property keys to the control flow graph
        final Expression value = propertyNode.getValue();
        if (value != null) {
            visitExpression(value);
        }
    }
    return pushExpressionType(objectNode);
}
项目:kaziranga    文件:CodeGenerator.java   
/**
 * Check if a property value contains a particular program point
 * @param value value
 * @param pp    program point
 * @return true if it's there.
 */
private static boolean propertyValueContains(final Expression value, final int pp) {
    return new Supplier<Boolean>() {
        boolean contains;

        @Override
        public Boolean get() {
            value.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
                @Override
                public boolean enterFunctionNode(final FunctionNode functionNode) {
                    return false;
                }

                @Override
                public boolean enterObjectNode(final ObjectNode objectNode) {
                    return false;
                }

                @Override
                public boolean enterDefault(final Node node) {
                    if (contains) {
                        return false;
                    }
                    if (node instanceof Optimistic && ((Optimistic)node).getProgramPoint() == pp) {
                        contains = true;
                        return false;
                    }
                    return true;
                }
            });

            return contains;
        }
    }.get();
}
项目:lookaside_java-1.8.0-openjdk    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:lookaside_java-1.8.0-openjdk    文件:ReplaceCompileUnits.java   
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
项目:lookaside_java-1.8.0-openjdk    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    for(final PropertyNode propertyNode: objectNode.getElements()) {
        // Avoid falsely adding property keys to the control flow graph
        final Expression value = propertyNode.getValue();
        if (value != null) {
            visitExpression(value);
        }
    }
    return pushExpressionType(objectNode);
}
项目:lookaside_java-1.8.0-openjdk    文件:CodeGenerator.java   
/**
 * Check if a property value contains a particular program point
 * @param value value
 * @param pp    program point
 * @return true if it's there.
 */
private static boolean propertyValueContains(final Expression value, final int pp) {
    return new Supplier<Boolean>() {
        boolean contains;

        @Override
        public Boolean get() {
            value.accept(new SimpleNodeVisitor() {
                @Override
                public boolean enterFunctionNode(final FunctionNode functionNode) {
                    return false;
                }

                @Override
                public boolean enterObjectNode(final ObjectNode objectNode) {
                    return false;
                }

                @Override
                public boolean enterDefault(final Node node) {
                    if (contains) {
                        return false;
                    }
                    if (node instanceof Optimistic && ((Optimistic)node).getProgramPoint() == pp) {
                        contains = true;
                        return false;
                    }
                    return true;
                }
            });

            return contains;
        }
    }.get();
}
项目:jdk8u_nashorn    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:jdk8u_nashorn    文件:ReplaceCompileUnits.java   
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
项目:jdk8u_nashorn    文件:LocalVariableTypesCalculator.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    for(final PropertyNode propertyNode: objectNode.getElements()) {
        // Avoid falsely adding property keys to the control flow graph
        final Expression value = propertyNode.getValue();
        if (value != null) {
            visitExpression(value);
        }
    }
    return pushExpressionType(objectNode);
}
项目:infobip-open-jdk-8    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:infobip-open-jdk-8    文件:CodeGenerator.java   
/**
 * Check if a property value contains a particular program point
 * @param value value
 * @param pp    program point
 * @return true if it's there.
 */
private static boolean propertyValueContains(final Expression value, final int pp) {
    return new Supplier<Boolean>() {
        boolean contains;

        @Override
        public Boolean get() {
            value.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
                @Override
                public boolean enterFunctionNode(final FunctionNode functionNode) {
                    return false;
                }

                @Override
                public boolean enterObjectNode(final ObjectNode objectNode) {
                    return false;
                }

                @Override
                public boolean enterDefault(final Node node) {
                    if (contains) {
                        return false;
                    }
                    if (node instanceof Optimistic && ((Optimistic)node).getProgramPoint() == pp) {
                        contains = true;
                        return false;
                    }
                    return true;
                }
            });

            return contains;
        }
    }.get();
}
项目:OLD-OpenJDK8    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:nashorn-backport    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:nashorn    文件:JSONWriter.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

    array("properties", objectNode.getElements());

    return leave();
}
项目:OpenJSharp    文件:JSONParser.java   
/**
     * Parse an object literal from the token stream
     * @return the object literal as a Node
     */
    private ObjectNode objectLiteral() {
        // Capture LBRACE token.
        final long objectToken = token;
        // LBRACE tested in caller.
        next();

        // Prepare to accumulate elements.
        final List<PropertyNode> elements = new ArrayList<>();

        // Create a block for the object literal.
loop:
        while (true) {
            switch (type) {
            case RBRACE:
                next();
                break loop;

            case COMMARIGHT:
                next();
                // check for trailing comma - not allowed in JSON
                if (type == RBRACE) {
                    throw error(AbstractParser.message("trailing.comma.in.json", type.getNameOrType()));
                }
                break;

            default:
                // Get and add the next property.
                final PropertyNode property = propertyAssignment();
                elements.add(property);

                // Comma between property assigments is mandatory in JSON.
                if (type != RBRACE && type != COMMARIGHT) {
                    throw error(AbstractParser.message("expected", ", or }", type.getNameOrType()));
                }
                break;
            }
        }

        // Construct new object literal.
        return new ObjectNode(objectToken, finish, elements);
    }
项目:openjdk-jdk10    文件:ObjectLiteralTreeImpl.java   
ObjectLiteralTreeImpl(final ObjectNode node, final List<? extends PropertyTree> props) {
    super(node);
    this.props = props;
}
项目:openjdk-jdk10    文件:Parser.java   
private boolean isDestructuringLhs(final Expression lhs) {
    if (lhs instanceof ObjectNode || lhs instanceof LiteralNode.ArrayLiteralNode) {
        return isES6();
    }
    return false;
}
项目:openjdk-jdk10    文件:Parser.java   
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    return true;
}
项目:openjdk9    文件:ObjectLiteralTreeImpl.java   
ObjectLiteralTreeImpl(final ObjectNode node, final List<? extends PropertyTree> props) {
    super(node);
    this.props = props;
}
项目:openjdk9    文件:Parser.java   
private boolean isDestructuringLhs(Expression lhs) {
    if (lhs instanceof ObjectNode || lhs instanceof LiteralNode.ArrayLiteralNode) {
        return isES6();
    }
    return false;
}
项目:infobip-open-jdk-8    文件:JSONParser.java   
/**
     * Parse an object literal from the token stream
     * @return the object literal as a Node
     */
    private ObjectNode objectLiteral() {
        // Capture LBRACE token.
        final long objectToken = token;
        // LBRACE tested in caller.
        next();

        // Prepare to accumulate elements.
        final List<PropertyNode> elements = new ArrayList<>();

        // Create a block for the object literal.
loop:
        while (true) {
            switch (type) {
            case RBRACE:
                next();
                break loop;

            case COMMARIGHT:
                next();
                // check for trailing comma - not allowed in JSON
                if (type == RBRACE) {
                    throw error(AbstractParser.message("trailing.comma.in.json", type.getNameOrType()));
                }
                break;

            default:
                // Get and add the next property.
                final PropertyNode property = propertyAssignment();
                elements.add(property);

                // Comma between property assigments is mandatory in JSON.
                if (type != RBRACE && type != COMMARIGHT) {
                    throw error(AbstractParser.message("expected", ", or }", type.getNameOrType()));
                }
                break;
            }
        }

        // Construct new object literal.
        return new ObjectNode(objectToken, finish, elements);
    }
项目:OLD-OpenJDK8    文件:JSONParser.java   
/**
     * Parse an object literal from the token stream
     * @return the object literal as a Node
     */
    private ObjectNode objectLiteral() {
        // Capture LBRACE token.
        final long objectToken = token;
        // LBRACE tested in caller.
        next();

        // Prepare to accumulate elements.
        final List<PropertyNode> elements = new ArrayList<>();

        // Create a block for the object literal.
loop:
        while (true) {
            switch (type) {
            case RBRACE:
                next();
                break loop;

            case COMMARIGHT:
                next();
                // check for trailing comma - not allowed in JSON
                if (type == RBRACE) {
                    throw error(AbstractParser.message("trailing.comma.in.json", type.getNameOrType()));
                }
                break;

            default:
                // Get and add the next property.
                final PropertyNode property = propertyAssignment();
                elements.add(property);

                // Comma between property assigments is mandatory in JSON.
                if (type != RBRACE && type != COMMARIGHT) {
                    throw error(AbstractParser.message("expected", ", or }", type.getNameOrType()));
                }
                break;
            }
        }

        // Construct new object literal.
        return new ObjectNode(objectToken, finish, elements);
    }