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


Java Symbol.isInternal方法代码示例

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


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

示例1: enterBinaryNode

import jdk.nashorn.internal.ir.Symbol; //导入方法依赖的package包/类
@Override
public boolean enterBinaryNode(final BinaryNode binaryNode) {
    if(binaryNode.isAssignment()) {
        final Expression lhs = binaryNode.lhs();
        if(!binaryNode.isSelfModifying()) {
            tagNeverOptimistic(lhs);
        }
        if(lhs instanceof IdentNode) {
            final Symbol symbol = ((IdentNode)lhs).getSymbol();
            // Assignment to internal symbols is never optimistic, except for self-assignment expressions
            if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) {
                tagNeverOptimistic(binaryNode.rhs());
            }
        }
    } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) {
        tagNeverOptimistic(binaryNode.lhs());
        tagNeverOptimistic(binaryNode.rhs());
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:OptimisticTypesCalculator.java

示例2: enterBinaryNode

import jdk.nashorn.internal.ir.Symbol; //导入方法依赖的package包/类
@Override
public boolean enterBinaryNode(final BinaryNode binaryNode) {
    if(binaryNode.isAssignment()) {
        final Expression lhs = binaryNode.lhs();
        if(!binaryNode.isSelfModifying()) {
            tagNeverOptimistic(lhs);
        }
        if(lhs instanceof IdentNode) {
            final Symbol symbol = ((IdentNode)lhs).getSymbol();
            // Assignment to internal symbols is never optimistic, except for self-assignment expressions
            if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) {
                tagNeverOptimistic(binaryNode.rhs());
            }
        }
    } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)
            || binaryNode.isTokenType(TokenType.EQ_STRICT)
            || binaryNode.isTokenType(TokenType.NE_STRICT)) {
        tagNeverOptimistic(binaryNode.lhs());
        tagNeverOptimistic(binaryNode.rhs());
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:OptimisticTypesCalculator.java

示例3: symbolNeedsToBeScope

import jdk.nashorn.internal.ir.Symbol; //导入方法依赖的package包/类
/**
 * Determines if the symbol has to be a scope symbol. In general terms, it has to be a scope symbol if it can only
 * be reached from the current block by traversing a function node, a split node, or a with node.
 * @param symbol the symbol checked for needing to be a scope symbol
 * @return true if the symbol has to be a scope symbol.
 */
private boolean symbolNeedsToBeScope(final Symbol symbol) {
    if (symbol.isThis() || symbol.isInternal()) {
        return false;
    }

    final FunctionNode func = lc.getCurrentFunction();
    if ( func.allVarsInScope() || (!symbol.isBlockScoped() && func.isProgram())) {
        return true;
    }

    boolean previousWasBlock = false;
    for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
        final LexicalContextNode node = it.next();
        if (node instanceof FunctionNode || isSplitArray(node)) {
            // We reached the function boundary or a splitting boundary without seeing a definition for the symbol.
            // It needs to be in scope.
            return true;
        } else if (node instanceof WithNode) {
            if (previousWasBlock) {
                // We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
                // preceded by a block, this means we're currently processing its expression, not its body,
                // therefore it doesn't count.
                return true;
            }
            previousWasBlock = false;
        } else if (node instanceof Block) {
            if (((Block)node).getExistingSymbol(symbol.getName()) == symbol) {
                // We reached the block that defines the symbol without reaching either the function boundary, or a
                // WithNode. The symbol need not be scoped.
                return false;
            }
            previousWasBlock = true;
        } else {
            previousWasBlock = false;
        }
    }
    throw new AssertionError();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:AssignSymbols.java

示例4: isInternalExpression

import jdk.nashorn.internal.ir.Symbol; //导入方法依赖的package包/类
/**
 * An internal expression has a symbol that is tagged internal. Check if
 * this is such a node
 *
 * @param expression expression to check for internal symbol
 * @return true if internal, false otherwise
 */
private static boolean isInternalExpression(final Expression expression) {
    if (!(expression instanceof IdentNode)) {
        return false;
    }
    final Symbol symbol = ((IdentNode)expression).getSymbol();
    return symbol != null && symbol.isInternal();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Lower.java

示例5: symbolNeedsToBeScope

import jdk.nashorn.internal.ir.Symbol; //导入方法依赖的package包/类
/**
 * Determines if the symbol has to be a scope symbol. In general terms, it has to be a scope symbol if it can only
 * be reached from the current block by traversing a function node, a split node, or a with node.
 * @param symbol the symbol checked for needing to be a scope symbol
 * @return true if the symbol has to be a scope symbol.
 */
private boolean symbolNeedsToBeScope(final Symbol symbol) {
    if (symbol.isThis() || symbol.isInternal()) {
        return false;
    }

    final FunctionNode func = lc.getCurrentFunction();
    if ( func.allVarsInScope() || (!symbol.isBlockScoped() && func.isProgram())) {
        return true;
    }

    boolean previousWasBlock = false;
    for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
        final LexicalContextNode node = it.next();
        if (node instanceof FunctionNode || isSplitLiteral(node)) {
            // We reached the function boundary or a splitting boundary without seeing a definition for the symbol.
            // It needs to be in scope.
            return true;
        } else if (node instanceof WithNode) {
            if (previousWasBlock) {
                // We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
                // preceded by a block, this means we're currently processing its expression, not its body,
                // therefore it doesn't count.
                return true;
            }
            previousWasBlock = false;
        } else if (node instanceof Block) {
            if (((Block)node).getExistingSymbol(symbol.getName()) == symbol) {
                // We reached the block that defines the symbol without reaching either the function boundary, or a
                // WithNode. The symbol need not be scoped.
                return false;
            }
            previousWasBlock = true;
        } else {
            previousWasBlock = false;
        }
    }
    throw new AssertionError();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:AssignSymbols.java


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