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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library kernel.transformations.closure_conversion; 5 library kernel.transformations.closure_conversion;
6 6
7 import '../ast.dart' show Class, Program; 7 import '../ast.dart' show Class, Program, Library;
8 8
9 import '../core_types.dart' show CoreTypes; 9 import '../core_types.dart' show CoreTypes;
10 10
11 import 'closure/converter.dart' show ClosureConverter; 11 import 'closure/converter.dart' show ClosureConverter;
12 12
13 import 'closure/info.dart' show ClosureInfo; 13 import 'closure/info.dart' show ClosureInfo;
14 14
15 import 'closure/invalidate_closures.dart'; 15 import 'closure/invalidate_closures.dart';
16 import 'closure/mock.dart' show mockUpContext; 16 import 'closure/mock.dart'
17 show mockUpContextForProgram, mockUpContextForLibraries;
17 18
18 Program transformProgram(CoreTypes coreTypes, Program program) { 19 Program transformProgram(CoreTypes coreTypes, Program program) {
19 var info = new ClosureInfo(); 20 var info = new ClosureInfo();
20 info.visitProgram(program); 21 info.visitProgram(program);
21 22
22 Class contextClass = mockUpContext(coreTypes, program); 23 Class contextClass = mockUpContextForProgram(coreTypes, program);
23 var convert = new ClosureConverter(coreTypes, info, contextClass); 24 var convert = new ClosureConverter(coreTypes, info, contextClass);
24 program = convert.visitProgram(program); 25 program = convert.visitProgram(program);
25 return new InvalidateClosures().visitProgram(program); 26 return new InvalidateClosures().visitProgram(program);
26 } 27 }
28
29 void transformLibraries(CoreTypes coreTypes, List<Library> libraries) {
30 var info = new ClosureInfo();
31 for (var library in libraries) {
32 info.visitLibrary(library);
33 }
34
35 Class contextClass = mockUpContextForLibraries(coreTypes, libraries);
36 var convert = new ClosureConverter(coreTypes, info, contextClass);
37 for (int i = 0; i < libraries.length; i++) {
38 libraries[i] = convert.visitLibrary(libraries[i]);
39 }
40 var invalidator = new InvalidateClosures();
41 for (int i = 0; i < libraries.length; i++) {
42 invalidator.visitLibrary(libraries[i]);
43 }
44 }
OLDNEW
« 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