diff options
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) { |