| OLD | NEW |
| 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 'package:kernel/ast.dart' | 9 import 'package:kernel/ast.dart' |
| 10 show | 10 show |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 void runBuildTransformations() { | 636 void runBuildTransformations() { |
| 637 backendTarget.performModularTransformationsOnLibraries( | 637 backendTarget.performModularTransformationsOnLibraries( |
| 638 loader.coreTypes, loader.hierarchy, loader.libraries, | 638 loader.coreTypes, loader.hierarchy, loader.libraries, |
| 639 logger: (String msg) => ticker.logMs(msg)); | 639 logger: (String msg) => ticker.logMs(msg)); |
| 640 backendTarget.performGlobalTransformations(loader.coreTypes, program, | 640 backendTarget.performGlobalTransformations(loader.coreTypes, program, |
| 641 logger: (String msg) => ticker.logMs(msg)); | 641 logger: (String msg) => ticker.logMs(msg)); |
| 642 } | 642 } |
| 643 | 643 |
| 644 void verify() { | 644 void verify() { |
| 645 var verifyErrors = verifyProgram(program); | 645 var verifyErrors = verifyProgram(program); |
| 646 errors.addAll(verifyErrors.map((error) => '$error')); | 646 errors.addAll(verifyErrors.map((error) => error.message)); |
| 647 ticker.logMs("Verified program"); | 647 ticker.logMs("Verified program"); |
| 648 } | 648 } |
| 649 | 649 |
| 650 /// Return `true` if the given [library] was built by this [KernelTarget] | 650 /// Return `true` if the given [library] was built by this [KernelTarget] |
| 651 /// from sources, and not loaded from a [DillTarget]. | 651 /// from sources, and not loaded from a [DillTarget]. |
| 652 bool isSourceLibrary(Library library) { | 652 bool isSourceLibrary(Library library) { |
| 653 return loader.libraries.contains(library); | 653 return loader.libraries.contains(library); |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 | 656 |
| 657 /// Looks for a constructor call that matches `super()` from a constructor in | 657 /// Looks for a constructor call that matches `super()` from a constructor in |
| 658 /// [cls]. Such a constructor may have optional arguments, but no required | 658 /// [cls]. Such a constructor may have optional arguments, but no required |
| 659 /// arguments. | 659 /// arguments. |
| 660 Constructor defaultSuperConstructor(Class cls) { | 660 Constructor defaultSuperConstructor(Class cls) { |
| 661 Class superclass = cls.superclass; | 661 Class superclass = cls.superclass; |
| 662 while (superclass != null && superclass.isMixinApplication) { | 662 while (superclass != null && superclass.isMixinApplication) { |
| 663 superclass = superclass.superclass; | 663 superclass = superclass.superclass; |
| 664 } | 664 } |
| 665 for (Constructor constructor in superclass.constructors) { | 665 for (Constructor constructor in superclass.constructors) { |
| 666 if (constructor.name.name.isEmpty) { | 666 if (constructor.name.name.isEmpty) { |
| 667 return constructor.function.requiredParameterCount == 0 | 667 return constructor.function.requiredParameterCount == 0 |
| 668 ? constructor | 668 ? constructor |
| 669 : null; | 669 : null; |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 return null; | 672 return null; |
| 673 } | 673 } |
| OLD | NEW |