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


Java IdentNode.getSymbol方法代码示例

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


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

示例1: initializeMethodParameters

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
/**
 * Incoming method parameters are always declared on method entry; declare them in the local variable table.
 * @param function function for which code is being generated.
 */
private void initializeMethodParameters(final FunctionNode function) {
    final Label functionStart = new Label("fn_start");
    method.label(functionStart);
    int nextSlot = 0;
    if(function.needsCallee()) {
        initializeInternalFunctionParameter(CALLEE, function, functionStart, nextSlot++);
    }
    initializeInternalFunctionParameter(THIS, function, functionStart, nextSlot++);
    if(function.isVarArg()) {
        initializeInternalFunctionParameter(VARARGS, function, functionStart, nextSlot++);
    } else {
        for(final IdentNode param: function.getParameters()) {
            final Symbol symbol = param.getSymbol();
            if(symbol.isBytecodeLocal()) {
                method.initializeMethodParameter(symbol, param.getType(), functionStart);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:CodeGenerator.java

示例2: checkConstAssignment

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
private void checkConstAssignment(final IdentNode ident) {
    // Check for reassignment of constant
    final Symbol symbol = ident.getSymbol();
    if (symbol.isConst()) {
        throwParserException(ECMAErrors.getMessage("syntax.error.assign.constant", symbol.getName()), ident);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:AssignSymbols.java

示例3: enterIdentNode

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
@Override
public boolean enterIdentNode(final IdentNode identNode) {
    final Symbol symbol = identNode.getSymbol();
    if(symbol.isBytecodeLocal()) {
        symbolIsUsed(symbol);
        setIdentifierLvarType(identNode, getLocalVariableType(symbol));
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:LocalVariableTypesCalculator.java

示例4: enterIdentNode

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
@Override
public boolean enterIdentNode(final IdentNode identNode) {
    final Symbol symbol = identNode.getSymbol();
    if(symbol.isBytecodeLocal()) {
        symbolIsUsed(symbol);
        final LvarType type = getLocalVariableType(symbol);
        setIdentifierLvarType(identNode, type);
        typeStack.push(type);
    } else {
        pushExpressionType(identNode);
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:LocalVariableTypesCalculator.java

示例5: isParamOrVar

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
private static boolean isParamOrVar(final IdentNode identNode) {
    final Symbol symbol = identNode.getSymbol();
    return symbol.isParam() || symbol.isVar();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:AssignSymbols.java

示例6: enterTryNode

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
@Override
public boolean enterTryNode(final TryNode tryNode) {
    if(!reachable) {
        return false;
    }

    // This is the label for the join point at the entry of the catch blocks.
    final Label catchLabel = new Label("");
    catchLabels.push(catchLabel);

    // Presume that even the start of the try block can immediately go to the catch
    jumpToLabel(tryNode, catchLabel);

    final Block body = tryNode.getBody();
    body.accept(this);
    catchLabels.pop();

    // Final exit label for the whole try/catch construct (after the try block and after all catches).
    final Label endLabel = new Label("");

    boolean canExit = false;
    if(reachable) {
        jumpToLabel(body, endLabel);
        canExit = true;
    }
    doesNotContinueSequentially();

    joinOnLabel(catchLabel);
    for(final CatchNode catchNode: tryNode.getCatches()) {
        final IdentNode exception = catchNode.getException();
        onAssignment(exception, LvarType.OBJECT);
        final Expression condition = catchNode.getExceptionCondition();
        if(condition != null) {
            condition.accept(this);
        }
        final Map<Symbol, LvarType> afterConditionTypes = localVariableTypes;
        final Block catchBody = catchNode.getBody();
        // TODO: currently, we consider that the catch blocks are always reachable from the try block as currently
        // we lack enough analysis to prove that no statement before a break/continue/return in the try block can
        // throw an exception.
        reachable = true;
        catchBody.accept(this);
        final Symbol exceptionSymbol = exception.getSymbol();
        if(reachable) {
            localVariableTypes = cloneMap(localVariableTypes);
            localVariableTypes.remove(exceptionSymbol);
            jumpToLabel(catchBody, endLabel);
            canExit = true;
        }
        localVariableTypes = cloneMap(afterConditionTypes);
        localVariableTypes.remove(exceptionSymbol);
    }
    // NOTE: if we had one or more conditional catch blocks with no unconditional catch block following them, then
    // there will be an unconditional rethrow, so the join point can never be reached from the last
    // conditionExpression.
    doesNotContinueSequentially();

    if(canExit) {
        joinOnLabel(endLabel);
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:64,代码来源:LocalVariableTypesCalculator.java

示例7: enterThrowNode

import jdk.nashorn.internal.ir.IdentNode; //导入方法依赖的package包/类
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(throwNode);

    if (throwNode.isSyntheticRethrow()) {
        method.beforeJoinPoint(throwNode);

        //do not wrap whatever this is in an ecma exception, just rethrow it
        final IdentNode exceptionExpr = (IdentNode)throwNode.getExpression();
        final Symbol exceptionSymbol = exceptionExpr.getSymbol();
        method.load(exceptionSymbol, EXCEPTION_TYPE);
        method.checkcast(EXCEPTION_TYPE.getTypeClass());
        method.athrow();
        return false;
    }

    final Source     source     = getCurrentSource();
    final Expression expression = throwNode.getExpression();
    final int        position   = throwNode.position();
    final int        line       = throwNode.getLineNumber();
    final int        column     = source.getColumn(position);

    // NOTE: we first evaluate the expression, and only after it was evaluated do we create the new ECMAException
    // object and then somewhat cumbersomely move it beneath the evaluated expression on the stack. The reason for
    // this is that if expression is optimistic (or contains an optimistic subexpression), we'd potentially access
    // the not-yet-<init>ialized object on the stack from the UnwarrantedOptimismException handler, and bytecode
    // verifier forbids that.
    loadExpressionAsObject(expression);

    method.load(source.getName());
    method.load(line);
    method.load(column);
    method.invoke(ECMAException.CREATE);

    method.beforeJoinPoint(throwNode);
    method.athrow();

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:CodeGenerator.java


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