Index: frog/world.dart |
diff --git a/frog/world.dart b/frog/world.dart |
index f41e934d29338a3a7b825a418cf8c95fcf953985..0e06f4130ebd96023ca062973f1a0b642649032b 100644 |
--- a/frog/world.dart |
+++ b/frog/world.dart |
@@ -406,6 +406,7 @@ class World { |
if (experimentalAwaitPhase != null) { |
withTiming('await translation', experimentalAwaitPhase); |
} |
+ withTiming('analyze pass', () { analyzeCode(lib); }); |
withTiming('generate code', () { generateCode(lib); }); |
} |
@@ -484,8 +485,18 @@ class World { |
return main; |
} |
- generateCode(Library lib) { |
+ /** |
+ * Walks all code in lib and imports for analysis. |
+ */ |
+ analyzeCode(Library lib) { |
gen = new WorldGenerator(findMainMethod(lib), new CodeWriter()); |
+ gen.analyze(); |
+ } |
+ |
+ /** |
+ * Walks all live code to generate JS source for output. |
+ */ |
+ generateCode(Library lib) { |
gen.run(); |
frogCode = gen.writer.text; |
jsBytesWritten = frogCode.length; |