本文整理汇总了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);
}
}
}
示例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);
}
}
示例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);
}
}