aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-16 16:30:49 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-16 16:30:49 -0800
commit192860dd8adba449bc5a60b8e858483f6833a058 (patch)
tree4e04f150c2971eb53644658c0023050aa43ef34c /tools/js-optimizer.js
parent153f2d93520f37525f30a3808b969c5533387a3c (diff)
optimize traverseGenerated
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js16
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) {