当前位置: 首页>>代码示例>>Java>>正文


Java ObjectNode类代码示例

本文整理汇总了Java中jdk.nashorn.internal.ir.ObjectNode的典型用法代码示例。如果您正苦于以下问题:Java ObjectNode类的具体用法?Java ObjectNode怎么用?Java ObjectNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了ObjectNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enterObjectNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:WeighNodes.java

示例2: enterObjectNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    enterDefault(objectNode);

    type("ObjectExpression");
    comma();

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

    return leave();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:JSONWriter.java

示例3: propertyValueContains

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:CodeGenerator.java

示例4: enterObjectNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:IRTranslator.java

示例5: leaveObjectNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:ReplaceCompileUnits.java

示例6: enterForNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Lower.java

示例7: enterASSIGN

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@Override
public boolean enterASSIGN(BinaryNode binaryNode) {
    if (es6 && (binaryNode.lhs() instanceof ObjectNode || binaryNode.lhs() instanceof ArrayLiteralNode)) {
        throwNotImplementedYet("es6.destructuring", binaryNode);
    }
    return super.enterASSIGN(binaryNode);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Lower.java

示例8: enterObjectNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:LocalVariableTypesCalculator.java

示例9: enterObjectNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:15,代码来源:IRTranslator.java

示例10: propertyValueContains

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:41,代码来源:CodeGenerator.java

示例11: objectLiteral

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
/**
     * 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);
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:JSONParser.java

示例12: ObjectLiteralTreeImpl

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
ObjectLiteralTreeImpl(final ObjectNode node, final List<? extends PropertyTree> props) {
    super(node);
    this.props = props;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:ObjectLiteralTreeImpl.java

示例13: isDestructuringLhs

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
private boolean isDestructuringLhs(final Expression lhs) {
    if (lhs instanceof ObjectNode || lhs instanceof LiteralNode.ArrayLiteralNode) {
        return isES6();
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:Parser.java

示例14: enterObjectNode

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:Parser.java

示例15: isDestructuringLhs

import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
private boolean isDestructuringLhs(Expression lhs) {
    if (lhs instanceof ObjectNode || lhs instanceof LiteralNode.ArrayLiteralNode) {
        return isES6();
    }
    return false;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:7,代码来源:Parser.java


注:本文中的jdk.nashorn.internal.ir.ObjectNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。