Chromium Code Reviews| Index: pkg/front_end/lib/src/fasta/source/source_loader.dart |
| diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart |
| index 7a0500fb694aa33b9f7e7edc325cf260925cfa3d..fcf8f3b2c6a0ce1c7c9f07e270677e6df79d925c 100644 |
| --- a/pkg/front_end/lib/src/fasta/source/source_loader.dart |
| +++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart |
| @@ -8,7 +8,10 @@ import 'dart:async' show Future; |
| import 'dart:typed_data' show Uint8List; |
| -import 'package:kernel/ast.dart' show Arguments, Expression, Program; |
| +import 'package:front_end/src/fasta/kernel/kernel_library_builder.dart' |
| + show KernelLibraryBuilder; |
| + |
| +import 'package:kernel/ast.dart' show Arguments, Class, Expression, Program; |
| import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; |
| @@ -496,6 +499,25 @@ class SourceLoader<L> extends Loader<L> { |
| ticker.logMs("Performed initializer inference"); |
| } |
| + /// Annotates method formals that require runtime checks to restore soundness |
| + /// as a result of the fact that Dart 2.0 treats all class type parameters as |
| + /// covariant. |
| + void computeFormalSafety() { |
| + if (target.strongMode) { |
| + var unorderedClasses = <Class>[]; |
| + builders.forEach((Uri uri, LibraryBuilder library) { |
|
ahe
2017/08/23 09:55:58
Can you pass in this list either from collectAllCl
Paul Berry
2017/08/23 17:09:10
Done.
|
| + if (library is KernelLibraryBuilder) { |
| + var builtLibrary = library.target; |
| + unorderedClasses.addAll(builtLibrary.classes); |
| + } |
| + }); |
| + for (var cls in hierarchy.getOrderedClasses(unorderedClasses)) { |
| + typeInferenceEngine.computeFormalSafety(cls); |
| + } |
| + ticker.logMs("Computed formal checks"); |
| + } |
| + } |
| + |
| List<Uri> getDependencies() => sourceBytes.keys.toList(); |
| Expression instantiateInvocation(Expression receiver, String name, |