本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例12: ObjectLiteralTreeImpl
import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
ObjectLiteralTreeImpl(final ObjectNode node, final List<? extends PropertyTree> props) {
super(node);
this.props = props;
}
示例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;
}
示例14: enterObjectNode
import jdk.nashorn.internal.ir.ObjectNode; //导入依赖的package包/类
@Override
public boolean enterObjectNode(final ObjectNode objectNode) {
return true;
}
示例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;
}