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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_target.dart

Issue 2723173002: Apply transformers and other work arounds to get boostrapping to work. (Closed)
Patch Set: Add exception class. Created 3 years, 9 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
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 fasta.kernel_target; 5 library fasta.kernel_target;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show File, IOSink; 9 import 'dart:io' show File, IOSink;
10 10
(...skipping 23 matching lines...) Expand all
34 SuperInitializer, 34 SuperInitializer,
35 Throw, 35 Throw,
36 VariableDeclaration, 36 VariableDeclaration,
37 VariableGet, 37 VariableGet,
38 VoidType; 38 VoidType;
39 39
40 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter; 40 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
41 41
42 import 'package:kernel/text/ast_to_text.dart' show Printer; 42 import 'package:kernel/text/ast_to_text.dart' show Printer;
43 43
44 import 'package:kernel/transformations/erasure.dart' show Erasure;
45
46 import 'package:kernel/transformations/continuation.dart' as transformAsync;
47
44 import 'package:kernel/transformations/mixin_full_resolution.dart' 48 import 'package:kernel/transformations/mixin_full_resolution.dart'
45 show MixinFullResolution; 49 show MixinFullResolution;
46 50
47 import 'package:kernel/transformations/setup_builtin_library.dart' 51 import 'package:kernel/transformations/setup_builtin_library.dart'
48 as setup_builtin_library; 52 as setup_builtin_library;
49 53
50 import '../source/source_loader.dart' show SourceLoader; 54 import '../source/source_loader.dart' show SourceLoader;
51 55
52 import '../source/source_class_builder.dart' show SourceClassBuilder; 56 import '../source/source_class_builder.dart' show SourceClassBuilder;
53 57
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 216 }
213 try { 217 try {
214 loader.computeHierarchy(program); 218 loader.computeHierarchy(program);
215 await loader.buildBodies(); 219 await loader.buildBodies();
216 loader.finishStaticInvocations(); 220 loader.finishStaticInvocations();
217 finishAllConstructors(); 221 finishAllConstructors();
218 loader.finishNativeMethods(); 222 loader.finishNativeMethods();
219 transformMixinApplications(); 223 transformMixinApplications();
220 // TODO(ahe): Don't call this from two different places. 224 // TODO(ahe): Don't call this from two different places.
221 setup_builtin_library.transformProgram(program); 225 setup_builtin_library.transformProgram(program);
226 otherTransformations();
222 errors.addAll(loader.collectCompileTimeErrors().map((e) => e.format())); 227 errors.addAll(loader.collectCompileTimeErrors().map((e) => e.format()));
223 if (errors.isNotEmpty) { 228 if (errors.isNotEmpty) {
224 return handleInputError(uri, null, isFullProgram: true); 229 return handleInputError(uri, null, isFullProgram: true);
225 } 230 }
226 if (uri == null) return program; 231 if (uri == null) return program;
227 return await writeLinkedProgram(uri, program, isFullProgram: true); 232 return await writeLinkedProgram(uri, program, isFullProgram: true);
228 } on InputError catch (e) { 233 } on InputError catch (e) {
229 return handleInputError(uri, e, isFullProgram: true); 234 return handleInputError(uri, e, isFullProgram: true);
230 } catch (e, s) { 235 } catch (e, s) {
231 return reportCrash(e, s, loader?.currentUriForCrashReporting); 236 return reportCrash(e, s, loader?.currentUriForCrashReporting);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } 547 }
543 } 548 }
544 }); 549 });
545 } 550 }
546 551
547 void transformMixinApplications() { 552 void transformMixinApplications() {
548 new MixinFullResolution().transform(program); 553 new MixinFullResolution().transform(program);
549 ticker.logMs("Transformed mixin applications"); 554 ticker.logMs("Transformed mixin applications");
550 } 555 }
551 556
557 void otherTransformations() {
558 // TODO(ahe): Don't generate type variables in the first place.
559 program.accept(new Erasure());
560 ticker.logMs("Erased type variables in generic methods");
561 // TODO(kmillikin): Make this run on a per-method basis.
562 transformAsync.transformProgram(program);
563 ticker.logMs("Transformed async methods");
564 }
565
552 void dumpIr() { 566 void dumpIr() {
553 StringBuffer sb = new StringBuffer(); 567 StringBuffer sb = new StringBuffer();
554 for (Library library in loader.libraries) { 568 for (Library library in loader.libraries) {
555 Printer printer = new Printer(sb); 569 Printer printer = new Printer(sb);
556 printer.writeLibraryFile(library); 570 printer.writeLibraryFile(library);
557 } 571 }
558 print("$sb"); 572 print("$sb");
559 } 573 }
560 } 574 }
561 575
(...skipping 17 matching lines...) Expand all
579 } 593 }
580 for (Constructor constructor in superclass.constructors) { 594 for (Constructor constructor in superclass.constructors) {
581 if (constructor.name.name.isEmpty) { 595 if (constructor.name.name.isEmpty) {
582 return constructor.function.requiredParameterCount == 0 596 return constructor.function.requiredParameterCount == 0
583 ? constructor 597 ? constructor
584 : null; 598 : null;
585 } 599 }
586 } 600 }
587 return null; 601 return null;
588 } 602 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/analyzer/analyzer_diet_listener.dart ('k') | pkg/front_end/lib/src/fasta/kernel/verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698