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

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

Issue 2832353002: Add support for building patched_sdk and platform.dill for dart2js: (Closed)
Patch Set: fix .gn circularity by removing use of rebase_path Created 3 years, 7 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 {bool dumpIr: false, bool verify: false}) async { 263 {bool dumpIr: false, bool verify: false}) async {
264 if (loader.first == null) return null; 264 if (loader.first == null) return null;
265 if (errors.isNotEmpty) { 265 if (errors.isNotEmpty) {
266 return handleInputError(uri, null, isFullProgram: true); 266 return handleInputError(uri, null, isFullProgram: true);
267 } 267 }
268 try { 268 try {
269 await loader.buildBodies(); 269 await loader.buildBodies();
270 loader.finishStaticInvocations(); 270 loader.finishStaticInvocations();
271 finishAllConstructors(); 271 finishAllConstructors();
272 loader.finishNativeMethods(); 272 loader.finishNativeMethods();
273 transformMixinApplications(); 273 runBuildTransformations();
274 // TODO(ahe): Don't call this from two different places. 274
275 setup_builtin_library.transformProgram(program);
276 otherTransformations();
277 if (dumpIr) this.dumpIr(); 275 if (dumpIr) this.dumpIr();
278 if (verify) this.verify(); 276 if (verify) this.verify();
279 errors.addAll(loader.collectCompileTimeErrors().map((e) => e.format())); 277 errors.addAll(loader.collectCompileTimeErrors().map((e) => e.format()));
280 if (errors.isNotEmpty) { 278 if (errors.isNotEmpty) {
281 return handleInputError(uri, null, isFullProgram: true); 279 return handleInputError(uri, null, isFullProgram: true);
282 } 280 }
283 if (uri == null) return program; 281 if (uri == null) return program;
284 return await writeLinkedProgram(uri, program, isFullProgram: true); 282 return await writeLinkedProgram(uri, program, isFullProgram: true);
285 } on InputError catch (e) { 283 } on InputError catch (e) {
286 return handleInputError(uri, e, isFullProgram: true); 284 return handleInputError(uri, e, isFullProgram: true);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // elements have a fileUri. 380 // elements have a fileUri.
383 uriToSource[""] = new Source(<int>[0], const <int>[]); 381 uriToSource[""] = new Source(<int>[0], const <int>[]);
384 Program program = new Program(libraries, uriToSource); 382 Program program = new Program(libraries, uriToSource);
385 if (loader.first != null) { 383 if (loader.first != null) {
386 Builder builder = loader.first.lookup("main", -1, null); 384 Builder builder = loader.first.lookup("main", -1, null);
387 if (builder is KernelProcedureBuilder) { 385 if (builder is KernelProcedureBuilder) {
388 program.mainMethod = builder.procedure; 386 program.mainMethod = builder.procedure;
389 } 387 }
390 } 388 }
391 if (errors.isEmpty || dillTarget.isLoaded) { 389 if (errors.isEmpty || dillTarget.isLoaded) {
392 setup_builtin_library.transformProgram(program); 390 runLinkTransformations(program);
393 } 391 }
394 ticker.logMs("Linked program"); 392 ticker.logMs("Linked program");
395 return program; 393 return program;
396 } 394 }
397 395
398 Future<Program> writeLinkedProgram(Uri uri, Program program, 396 Future<Program> writeLinkedProgram(Uri uri, Program program,
399 {bool isFullProgram}) async { 397 {bool isFullProgram}) async {
400 File output = new File.fromUri(uri); 398 File output = new File.fromUri(uri);
401 IOSink sink = output.openWrite(); 399 IOSink sink = output.openWrite();
402 try { 400 try {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 if (field.initializer == null) { 668 if (field.initializer == null) {
671 FieldInitializer initializer = 669 FieldInitializer initializer =
672 new FieldInitializer(field, new NullLiteral()); 670 new FieldInitializer(field, new NullLiteral());
673 initializer.parent = constructor; 671 initializer.parent = constructor;
674 constructor.initializers.insert(0, initializer); 672 constructor.initializers.insert(0, initializer);
675 } 673 }
676 } 674 }
677 }); 675 });
678 } 676 }
679 677
678 /// Run all transformations that are needed when building a program for the
679 /// first time.
680 void runBuildTransformations() {
681 transformMixinApplications();
682 // TODO(ahe): Don't call this from two different places.
683 setup_builtin_library.transformProgram(program);
684 otherTransformations();
685 }
686
687 /// Run all transformations that are needed when linking a program.
688 void runLinkTransformations(Program program) {
689 setup_builtin_library.transformProgram(program);
690 }
691
680 void transformMixinApplications() { 692 void transformMixinApplications() {
681 new MixinFullResolution().transform(program); 693 new MixinFullResolution().transform(program);
682 ticker.logMs("Transformed mixin applications"); 694 ticker.logMs("Transformed mixin applications");
683 } 695 }
684 696
685 void otherTransformations() { 697 void otherTransformations() {
686 // TODO(ahe): Don't generate type variables in the first place. 698 // TODO(ahe): Don't generate type variables in the first place.
687 program.accept(new Erasure()); 699 program.accept(new Erasure());
688 ticker.logMs("Erased type variables in generic methods"); 700 ticker.logMs("Erased type variables in generic methods");
689 // TODO(kmillikin): Make this run on a per-method basis. 701 // TODO(kmillikin): Make this run on a per-method basis.
(...skipping 27 matching lines...) Expand all
717 } 729 }
718 for (Constructor constructor in superclass.constructors) { 730 for (Constructor constructor in superclass.constructors) {
719 if (constructor.name.name.isEmpty) { 731 if (constructor.name.name.isEmpty) {
720 return constructor.function.requiredParameterCount == 0 732 return constructor.function.requiredParameterCount == 0
721 ? constructor 733 ? constructor
722 : null; 734 : null;
723 } 735 }
724 } 736 }
725 return null; 737 return null;
726 } 738 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/dart_vm_native.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698