diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-16 16:30:49 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-16 16:30:49 -0800 |
commit | 192860dd8adba449bc5a60b8e858483f6833a058 (patch) | |
tree | 4e04f150c2971eb53644658c0023050aa43ef34c /tools/js-optimizer.js | |
parent | 153f2d93520f37525f30a3808b969c5533387a3c (diff) |
optimize traverseGenerated
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r-- | tools/js-optimizer.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index c8766bc6..7266df77 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -216,16 +216,6 @@ function traverse(node, pre, post, stack) { } // Only walk through the generated functions -function traverseGenerated(ast, pre, post, stack) { - assert(generatedFunctions); - traverse(ast, function(node) { - if (node[0] === 'defun') { - traverse(node, pre, post, stack); - return null; - } - }); -} - function traverseGeneratedFunctions(ast, callback) { assert(generatedFunctions); if (ast[0] === 'toplevel') { @@ -239,6 +229,12 @@ function traverseGeneratedFunctions(ast, callback) { } } +function traverseGenerated(ast, pre, post, stack) { + traverseGeneratedFunctions(ast, function(func) { + traverse(func, pre, post, stack); + }); +} + // Walk the ast in a simple way, with an understanding of which JS variables are defined) function traverseWithVariables(ast, callback) { traverse(ast, function(node, type, stack) { |