Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: pkg/kernel/lib/transformations/closure_conversion.dart

Issue 2938773003: Add transformLibraries for closure conversion (Closed)
Patch Set: Merge-in lastest changes in master (f71e6fd49b) Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/lib/transformations/closure/mock.dart ('k') | pkg/kernel/test/closures/suite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]);
+ }
+}
« no previous file with comments | « pkg/kernel/lib/transformations/closure/mock.dart ('k') | pkg/kernel/test/closures/suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698