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


Java PropertyNode类代码示例

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


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

示例1: propertyAssignment

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
/**
 * Parse a property assignment from the token stream
 * @return the property assignment as a Node
 */
private PropertyNode propertyAssignment() {
    // Capture firstToken.
    final long propertyToken = token;
    LiteralNode<?> name = null;

    if (type == STRING) {
        name = getStringLiteral();
    } else if (type == ESCSTRING) {
        name = getLiteral();
    }

    if (name != null) {
        expect(COLON);
        final Expression value = jsonLiteral();
        return new PropertyNode(propertyToken, value.getFinish(), name, value, null, null);
    }

    // Raise an error.
    throw error(AbstractParser.message("expected", "string", type.getNameOrType()));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:JSONParser.java

示例2: checkPropertyRedefinition

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
private void checkPropertyRedefinition(final PropertyNode property, final Expression value, final FunctionNode getter, final FunctionNode setter, final Expression prevValue, final FunctionNode prevGetter, final FunctionNode prevSetter) {
    // ECMA 11.1.5 strict mode restrictions
    if (isStrictMode && value != null && prevValue != null) {
        throw error(AbstractParser.message("property.redefinition", property.getKeyName()), property.getToken());
    }

    final boolean isPrevAccessor = prevGetter != null || prevSetter != null;
    final boolean isAccessor     = getter != null     || setter != null;

    // data property redefined as accessor property
    if (prevValue != null && isAccessor) {
        throw error(AbstractParser.message("property.redefinition", property.getKeyName()), property.getToken());
    }

    // accessor property redefined as data
    if (isPrevAccessor && value != null) {
        throw error(AbstractParser.message("property.redefinition", property.getKeyName()), property.getToken());
    }

    if (isAccessor && isPrevAccessor) {
        if (getter != null && prevGetter != null ||
                setter != null && prevSetter != null) {
            throw error(AbstractParser.message("property.redefinition", property.getKeyName()), property.getToken());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:Parser.java

示例3: enterObjectNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的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

示例4: enterPropertyNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
@Override
public boolean enterPropertyNode(final PropertyNode propertyNode) {
    if(propertyNode.getKeyName().equals(ScriptObject.PROTO_PROPERTY_NAME)) {
        tagNeverOptimistic(propertyNode.getValue());
    }
    return super.enterPropertyNode(propertyNode);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:OptimisticTypesCalculator.java

示例5: enterPropertyNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
@Override
public boolean enterPropertyNode(final PropertyNode propertyNode) {
    // Avoid falsely adding property keys to the control flow graph
    if(propertyNode.getValue() != null) {
        propertyNode.getValue().accept(this);
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:LocalVariableTypesCalculator.java

示例6: enterObjectNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的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

示例7: translateProperties

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
private List<? extends PropertyTree> translateProperties(final List<PropertyNode> propNodes) {
    final List<PropertyTree> propTrees = new ArrayList<>(propNodes.size());
    for (final PropertyNode propNode : propNodes) {
        propTrees.add(translateProperty(propNode));
    }
    return propTrees;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:IRTranslator.java

示例8: translateProperty

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
private PropertyTree translateProperty(final PropertyNode propNode) {
    return new PropertyTreeImpl(propNode,
                translateExpr(propNode.getKey()),
                translateExpr(propNode.getValue()),
                (FunctionExpressionTree) translateExpr(propNode.getGetter()),
                (FunctionExpressionTree) translateExpr(propNode.getSetter()));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:IRTranslator.java

示例9: PropertyTreeImpl

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
PropertyTreeImpl(final PropertyNode node,
        final ExpressionTree key,
        final ExpressionTree value,
        final FunctionExpressionTree getter,
        final FunctionExpressionTree setter) {
    super(node);
    this.key    = key;
    this.value  = value;
    this.getter = getter;
    this.setter = setter;
    this.isStatic = node.isStatic();
    this.isComputed = node.isComputed();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:PropertyTreeImpl.java

示例10: enterPropertyNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
@Override
public boolean enterPropertyNode(final PropertyNode propertyNode) {
    if (propertyNode.getValue() != null) {
        propertyNode.getValue().accept(this);
        return false;
    } else {
        return enterDefault(propertyNode);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:Parser.java

示例11: enterPropertyNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
@Override
public boolean enterPropertyNode(final PropertyNode propertyNode) {
    if(ScriptObject.PROTO_PROPERTY_NAME.equals(propertyNode.getKeyName())) {
        tagNeverOptimistic(propertyNode.getValue());
    }
    return super.enterPropertyNode(propertyNode);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:OptimisticTypesCalculator.java

示例12: enterObjectNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的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

示例13: enterObjectNode

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的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

示例14: PropertyTreeImpl

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的package包/类
PropertyTreeImpl(final PropertyNode node,
        final ExpressionTree key,
        final ExpressionTree value,
        final FunctionExpressionTree getter,
        final FunctionExpressionTree setter) {
    super(node);
    this.key    = key;
    this.value  = value;
    this.getter = getter;
    this.setter = setter;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:12,代码来源:PropertyTreeImpl.java

示例15: objectLiteral

import jdk.nashorn.internal.ir.PropertyNode; //导入依赖的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


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