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