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


Java FunctionNode.FUNCTION_STATEMENT属性代码示例

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


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

示例1: generateNestedFunctionInits

private void generateNestedFunctionInits()
{
    int functionCount = scriptOrFn.getFunctionCount();
    for (int i = 0; i != functionCount; i++) {
        OptFunctionNode ofn = OptFunctionNode.get(scriptOrFn, i);
        if (ofn.fnode.getFunctionType()
                == FunctionNode.FUNCTION_STATEMENT)
        {
            visitFunction(ofn, FunctionNode.FUNCTION_STATEMENT);
        }
    }
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:12,代码来源:Codegen.java

示例2: transform

private void transform(ScriptNode tree)
{
    initOptFunctions_r(tree);

    int optLevel = compilerEnv.getOptimizationLevel();

    Map<String,OptFunctionNode> possibleDirectCalls = null;
    if (optLevel > 0) {
       /*
        * Collect all of the contained functions into a hashtable
        * so that the call optimizer can access the class name & parameter
        * count for any call it encounters
        */
        if (tree.getType() == Token.SCRIPT) {
            int functionCount = tree.getFunctionCount();
            for (int i = 0; i != functionCount; ++i) {
                OptFunctionNode ofn = OptFunctionNode.get(tree, i);
                if (ofn.fnode.getFunctionType()
                    == FunctionNode.FUNCTION_STATEMENT)
                {
                    String name = ofn.fnode.getName();
                    if (name.length() != 0) {
                        if (possibleDirectCalls == null) {
                            possibleDirectCalls = new HashMap<String,OptFunctionNode>();
                        }
                        possibleDirectCalls.put(name, ofn);
                    }
                }
            }
        }
    }

    if (possibleDirectCalls != null) {
        directCallTargets = new ObjArray();
    }

    OptTransformer ot = new OptTransformer(possibleDirectCalls,
                                           directCallTargets);
    ot.transform(tree, compilerEnv);

    if (optLevel > 0) {
        (new Optimizer()).optimize(tree);
    }
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:44,代码来源:Codegen.java

示例3: transform

private void transform(ScriptNode tree)
{
    initOptFunctions_r(tree);

    int optLevel = compilerEnv.getOptimizationLevel();

    Map<String,OptFunctionNode> possibleDirectCalls = null;
    if (optLevel > 0) {
       /*
        * Collect all of the contained functions into a hashtable
        * so that the call optimizer can access the class name & parameter
        * count for any call it encounters
        */
        if (tree.getType() == Token.SCRIPT) {
            int functionCount = tree.getFunctionCount();
            for (int i = 0; i != functionCount; ++i) {
                OptFunctionNode ofn = OptFunctionNode.get(tree, i);
                if (ofn.fnode.getFunctionType()
                    == FunctionNode.FUNCTION_STATEMENT)
                {
                    String name = ofn.fnode.getName();
                    if (name.length() != 0) {
                        if (possibleDirectCalls == null) {
                            possibleDirectCalls = new HashMap<String,OptFunctionNode>();
                        }
                        possibleDirectCalls.put(name, ofn);
                    }
                }
            }
        }
    }

    if (possibleDirectCalls != null) {
        directCallTargets = new ObjArray();
    }

    OptTransformer ot = new OptTransformer(possibleDirectCalls,
                                           directCallTargets);
    ot.transform(tree);

    if (optLevel > 0) {
        (new Optimizer()).optimize(tree);
    }
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:44,代码来源:Codegen.java


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