Index: pkg/kernel/lib/transformations/closure_conversion.dart |
diff --git a/pkg/kernel/lib/transformations/closure_conversion.dart b/pkg/kernel/lib/transformations/closure_conversion.dart |
index 5588e8006aeab2b48cc191c60d59648e4845b449..70f48f5dc1bc1665b8c28bc644640a1632150fe5 100644 |
--- a/pkg/kernel/lib/transformations/closure_conversion.dart |
+++ b/pkg/kernel/lib/transformations/closure_conversion.dart |
@@ -4,7 +4,7 @@ |
library kernel.transformations.closure_conversion; |
-import '../ast.dart' show Class, Program; |
+import '../ast.dart' show Class, Program, Library; |
import '../core_types.dart' show CoreTypes; |
@@ -13,14 +13,32 @@ import 'closure/converter.dart' show ClosureConverter; |
import 'closure/info.dart' show ClosureInfo; |
import 'closure/invalidate_closures.dart'; |
-import 'closure/mock.dart' show mockUpContext; |
+import 'closure/mock.dart' |
+ show mockUpContextForProgram, mockUpContextForLibraries; |
Program transformProgram(CoreTypes coreTypes, Program program) { |
var info = new ClosureInfo(); |
info.visitProgram(program); |
- Class contextClass = mockUpContext(coreTypes, program); |
+ Class contextClass = mockUpContextForProgram(coreTypes, program); |
var convert = new ClosureConverter(coreTypes, info, contextClass); |
program = convert.visitProgram(program); |
return new InvalidateClosures().visitProgram(program); |
} |
+ |
+void transformLibraries(CoreTypes coreTypes, List<Library> libraries) { |
+ var info = new ClosureInfo(); |
+ for (var library in libraries) { |
+ info.visitLibrary(library); |
+ } |
+ |
+ Class contextClass = mockUpContextForLibraries(coreTypes, libraries); |
+ var convert = new ClosureConverter(coreTypes, info, contextClass); |
+ for (int i = 0; i < libraries.length; i++) { |
+ libraries[i] = convert.visitLibrary(libraries[i]); |
+ } |
+ var invalidator = new InvalidateClosures(); |
+ for (int i = 0; i < libraries.length; i++) { |
+ invalidator.visitLibrary(libraries[i]); |
+ } |
+} |