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.dill_loader; | 5 library fasta.dill_loader; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'package:kernel/ast.dart' show Library, Program, Source; | 9 import 'package:kernel/ast.dart' show Library, Program, Source; |
10 | 10 |
11 import '../errors.dart' show internalError; | 11 import '../deprecated_problems.dart' show deprecated_internalProblem; |
12 import '../loader.dart' show Loader; | 12 import '../loader.dart' show Loader; |
13 import '../target_implementation.dart' show TargetImplementation; | 13 import '../target_implementation.dart' show TargetImplementation; |
14 import 'dill_library_builder.dart' show DillLibraryBuilder; | 14 import 'dill_library_builder.dart' show DillLibraryBuilder; |
15 | 15 |
16 class DillLoader extends Loader<Library> { | 16 class DillLoader extends Loader<Library> { |
17 /// Source targets are compiled against these binary libraries. | 17 /// Source targets are compiled against these binary libraries. |
18 final libraries = <Library>[]; | 18 final libraries = <Library>[]; |
19 | 19 |
20 /// Sources for all appended programs. | 20 /// Sources for all appended programs. |
21 final Map<String, Source> uriToSource = <String, Source>{}; | 21 final Map<String, Source> uriToSource = <String, Source>{}; |
(...skipping 12 matching lines...) Expand all Loading... |
34 builder.library = library; | 34 builder.library = library; |
35 builders.add(builder); | 35 builders.add(builder); |
36 } | 36 } |
37 } | 37 } |
38 uriToSource.addAll(program.uriToSource); | 38 uriToSource.addAll(program.uriToSource); |
39 return builders; | 39 return builders; |
40 } | 40 } |
41 | 41 |
42 Future<Null> buildOutline(DillLibraryBuilder builder) async { | 42 Future<Null> buildOutline(DillLibraryBuilder builder) async { |
43 if (builder.library == null) { | 43 if (builder.library == null) { |
44 internalError("Builder.library for ${builder.uri} should not be null."); | 44 deprecated_internalProblem( |
| 45 "Builder.library for ${builder.uri} should not be null."); |
45 } | 46 } |
46 builder.library.classes.forEach(builder.addClass); | 47 builder.library.classes.forEach(builder.addClass); |
47 builder.library.procedures.forEach(builder.addMember); | 48 builder.library.procedures.forEach(builder.addMember); |
48 builder.library.typedefs.forEach(builder.addTypedef); | 49 builder.library.typedefs.forEach(builder.addTypedef); |
49 builder.library.fields.forEach(builder.addMember); | 50 builder.library.fields.forEach(builder.addMember); |
50 } | 51 } |
51 | 52 |
52 Future<Null> buildBody(DillLibraryBuilder builder) { | 53 Future<Null> buildBody(DillLibraryBuilder builder) { |
53 return buildOutline(builder); | 54 return buildOutline(builder); |
54 } | 55 } |
55 } | 56 } |
OLD | NEW |