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.source_library_builder; | 5 library fasta.source_library_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' show | 7 import 'package:kernel/ast.dart' show |
8 AsyncMarker, | 8 AsyncMarker, |
9 ProcedureKind; | 9 ProcedureKind; |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 abstract class SourceLibraryBuilder<T extends TypeBuilder, R> | 46 abstract class SourceLibraryBuilder<T extends TypeBuilder, R> |
47 extends LibraryBuilder<T, R> { | 47 extends LibraryBuilder<T, R> { |
48 final SourceLoader loader; | 48 final SourceLoader loader; |
49 | 49 |
50 final DeclarationBuilder<T> libraryDeclaration = | 50 final DeclarationBuilder<T> libraryDeclaration = |
51 new DeclarationBuilder<T>(<String, Builder>{}, null); | 51 new DeclarationBuilder<T>(<String, Builder>{}, null); |
52 | 52 |
53 final List<ConstructorReferenceBuilder> constructorReferences = | 53 final List<ConstructorReferenceBuilder> constructorReferences = |
54 <ConstructorReferenceBuilder>[]; | 54 <ConstructorReferenceBuilder>[]; |
55 | 55 |
56 final List<LibraryBuilder> parts = <LibraryBuilder>[]; | 56 final List<SourceLibraryBuilder<T, R>> parts = <SourceLibraryBuilder<T, R>>[]; |
57 | 57 |
58 final List<Import> imports = <Import>[]; | 58 final List<Import> imports = <Import>[]; |
59 | 59 |
60 final Map<String, Builder> exports = <String, Builder>{}; | 60 final Map<String, Builder> exports = <String, Builder>{}; |
61 | 61 |
62 final Scope scope = new Scope(<String, Builder>{}, null, isModifiable: false); | 62 final Scope scope = new Scope(<String, Builder>{}, null, isModifiable: false); |
63 | 63 |
64 final Uri fileUri; | 64 final Uri fileUri; |
65 | 65 |
66 String name; | 66 String name; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 if (parts.isNotEmpty) { | 257 if (parts.isNotEmpty) { |
258 internalError("Part with parts: $uri"); | 258 internalError("Part with parts: $uri"); |
259 } | 259 } |
260 if (exporters.isNotEmpty) { | 260 if (exporters.isNotEmpty) { |
261 internalError( | 261 internalError( |
262 "${exporters.first.exporter.uri} attempts to export the part $uri."); | 262 "${exporters.first.exporter.uri} attempts to export the part $uri."); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 void includeParts() { | 266 void includeParts() { |
267 for (LibraryBuilder part in parts.toList()) { | 267 for (SourceLibraryBuilder<T, R> part in parts.toList()) { |
268 includePart(part); | 268 includePart(part); |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 void includePart(SourceLibraryBuilder part) { | 272 void includePart(SourceLibraryBuilder<T, R> part) { |
273 if (name != null) { | 273 if (name != null) { |
274 if (part.partOf == null) { | 274 if (part.partOf == null) { |
275 print("${part.uri} has no 'part of' declaration but is used as a part " | 275 print("${part.uri} has no 'part of' declaration but is used as a part " |
276 "by ${name} ($uri)"); | 276 "by ${name} ($uri)"); |
277 parts.remove(part); | 277 parts.remove(part); |
278 return; | 278 return; |
279 } | 279 } |
280 if (part.partOf != name) { | 280 if (part.partOf != name) { |
281 print("${part.uri} is part of '${part.partOf}' but is used as a part " | 281 print("${part.uri} is part of '${part.partOf}' but is used as a part " |
282 "by '${name}' ($uri)"); | 282 "by '${name}' ($uri)"); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // parent declaration. | 414 // parent declaration. |
415 parent.addType(type); | 415 parent.addType(type); |
416 } else { | 416 } else { |
417 type.bind(builder); | 417 type.bind(builder); |
418 } | 418 } |
419 } | 419 } |
420 } | 420 } |
421 types.clear(); | 421 types.clear(); |
422 } | 422 } |
423 } | 423 } |
OLD | NEW |