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


Java FunctionNode.isGenerator方法代码示例

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


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

示例1: generateFunctionICode

import org.mozilla.javascript.ast.FunctionNode; //导入方法依赖的package包/类
private void generateFunctionICode()
{
    itsInFunctionFlag = true;

    FunctionNode theFunction = (FunctionNode)scriptOrFn;

    itsData.itsFunctionType = theFunction.getFunctionType();
    itsData.itsNeedsActivation = theFunction.requiresActivation();
    if (theFunction.getFunctionName() != null) {
        itsData.itsName = theFunction.getName();
    }
    if (theFunction.isGenerator()) {
      addIcode(Icode_GENERATOR);
      addUint16(theFunction.getBaseLineno() & 0xFFFF);
    }
    if (theFunction.isInStrictMode()) {
        itsData.isStrict = true;
    }

    generateICodeFromTree(theFunction.getLastChild());
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:22,代码来源:CodeGenerator.java

示例2: generateFunctionICode

import org.mozilla.javascript.ast.FunctionNode; //导入方法依赖的package包/类
private void generateFunctionICode()
{
    itsInFunctionFlag = true;

    FunctionNode theFunction = (FunctionNode)scriptOrFn;

    itsData.itsFunctionType = theFunction.getFunctionType();
    itsData.itsNeedsActivation = theFunction.requiresActivation();
    if (theFunction.getFunctionName() != null) {
        itsData.itsName = theFunction.getName();
    }
    if (!theFunction.getIgnoreDynamicScope()) {
        if (compilerEnv.isUseDynamicScope()) {
            itsData.useDynamicScope = true;
        }
    }
    if (theFunction.isGenerator()) {
      addIcode(Icode_GENERATOR);
      addUint16(theFunction.getBaseLineno() & 0xFFFF);
    }

    generateICodeFromTree(theFunction.getLastChild());
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:24,代码来源:CodeGenerator.java

示例3: generateFunctionICode

import org.mozilla.javascript.ast.FunctionNode; //导入方法依赖的package包/类
private void generateFunctionICode()
{
    itsInFunctionFlag = true;

    FunctionNode theFunction = (FunctionNode)scriptOrFn;

    itsData.itsFunctionType = theFunction.getFunctionType();
    itsData.itsNeedsActivation = theFunction.requiresActivation();
    if (theFunction.getFunctionName() != null) {
        itsData.itsName = theFunction.getName();
    }
    if (theFunction.isGenerator()) {
      addIcode(Icode_GENERATOR);
      addUint16(theFunction.getBaseLineno() & 0xFFFF);
    }

    generateICodeFromTree(theFunction.getLastChild());
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:19,代码来源:CodeGenerator.java

示例4: arrowFunction

import org.mozilla.javascript.ast.FunctionNode; //导入方法依赖的package包/类
private AstNode arrowFunction(AstNode params) throws IOException {
    int baseLineno = ts.lineno;  // line number where source starts
    int functionSourceStart = params != null ? params.getPosition() : -1;  // start of "function" kwd

    FunctionNode fnNode = new FunctionNode(functionSourceStart);
    fnNode.setFunctionType(FunctionNode.ARROW_FUNCTION);
    fnNode.setJsDocNode(getAndResetJsDoc());

    // Would prefer not to call createDestructuringAssignment until codegen,
    // but the symbol definitions have to happen now, before body is parsed.
    Map<String, Node> destructuring = new HashMap<String, Node>();
    Set<String> paramNames = new HashSet<String>();

    PerFunctionVariables savedVars = new PerFunctionVariables(fnNode);
    try {
        if (params instanceof ParenthesizedExpression) {
            fnNode.setParens(0, params.getLength());
            AstNode p = ((ParenthesizedExpression)params).getExpression();
            if (!(p instanceof EmptyExpression)) {
                arrowFunctionParams(fnNode, p, destructuring, paramNames);
            }
        } else {
            arrowFunctionParams(fnNode, params, destructuring, paramNames);
        }

        if (!destructuring.isEmpty()) {
            Node destructuringNode = new Node(Token.COMMA);
            // Add assignment helper for each destructuring parameter
            for (Map.Entry<String, Node> param: destructuring.entrySet()) {
                Node assign = createDestructuringAssignment(Token.VAR,
                                                            param.getValue(), createName(param.getKey()));
                destructuringNode.addChildToBack(assign);

            }
            fnNode.putProp(Node.DESTRUCTURING_PARAMS, destructuringNode);
        }
            
        fnNode.setBody(parseFunctionBody(FunctionNode.ARROW_FUNCTION, fnNode));
        fnNode.setEncodedSourceBounds(functionSourceStart, ts.tokenEnd);
        fnNode.setLength(ts.tokenEnd - functionSourceStart);
    } finally {
        savedVars.restore();
    }

    if (fnNode.isGenerator()) {
        reportError("msg.arrowfunction.generator");
        return makeErrorNode();
    }

    fnNode.setSourceName(sourceURI);
    fnNode.setBaseLineno(baseLineno);
    fnNode.setEndLineno(ts.lineno);

    return fnNode;
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:56,代码来源:Parser.java


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