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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 extends LibraryBuilder<T, R> { | 47 extends LibraryBuilder<T, R> { |
48 final SourceLoader loader; | 48 final SourceLoader loader; |
49 | 49 |
50 final Map<String, Builder> members = <String, Builder>{}; | 50 final Map<String, Builder> members = <String, Builder>{}; |
51 | 51 |
52 final List<T> types = <T>[]; | 52 final List<T> types = <T>[]; |
53 | 53 |
54 final List<ConstructorReferenceBuilder> constructorReferences = | 54 final List<ConstructorReferenceBuilder> constructorReferences = |
55 <ConstructorReferenceBuilder>[]; | 55 <ConstructorReferenceBuilder>[]; |
56 | 56 |
57 final List<LibraryBuilder> parts = <LibraryBuilder>[]; | 57 final List<SourceLibraryBuilder<T, R>> parts = <SourceLibraryBuilder<T, R>>[]; |
58 | 58 |
59 final List<Import> imports = <Import>[]; | 59 final List<Import> imports = <Import>[]; |
60 | 60 |
61 final Map<String, Builder> exports = <String, Builder>{}; | 61 final Map<String, Builder> exports = <String, Builder>{}; |
62 | 62 |
63 final Scope scope = new Scope(<String, Builder>{}, null, isModifiable: false); | 63 final Scope scope = new Scope(<String, Builder>{}, null, isModifiable: false); |
64 | 64 |
65 final Uri fileUri; | 65 final Uri fileUri; |
66 | 66 |
67 String name; | 67 String name; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (parts.isNotEmpty) { | 236 if (parts.isNotEmpty) { |
237 internalError("Part with parts: $uri"); | 237 internalError("Part with parts: $uri"); |
238 } | 238 } |
239 if (exporters.isNotEmpty) { | 239 if (exporters.isNotEmpty) { |
240 internalError( | 240 internalError( |
241 "${exporters.first.exporter.uri} attempts to export the part $uri."); | 241 "${exporters.first.exporter.uri} attempts to export the part $uri."); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 void includeParts() { | 245 void includeParts() { |
246 for (LibraryBuilder part in parts.toList()) { | 246 for (SourceLibraryBuilder<T, R> part in parts.toList()) { |
247 includePart(part); | 247 includePart(part); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 void includePart(SourceLibraryBuilder part) { | 251 void includePart(SourceLibraryBuilder<T, R> part) { |
252 if (name != null) { | 252 if (name != null) { |
253 if (part.partOf == null) { | 253 if (part.partOf == null) { |
254 print("${part.uri} has no 'part of' declaration but is used as a part " | 254 print("${part.uri} has no 'part of' declaration but is used as a part " |
255 "by ${name} ($uri)"); | 255 "by ${name} ($uri)"); |
256 parts.remove(part); | 256 parts.remove(part); |
257 return; | 257 return; |
258 } | 258 } |
259 if (part.partOf != name) { | 259 if (part.partOf != name) { |
260 print("${part.uri} is part of '${part.partOf}' but is used as a part " | 260 print("${part.uri} is part of '${part.partOf}' but is used as a part " |
261 "by '${name}' ($uri)"); | 261 "by '${name}' ($uri)"); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 | 334 |
335 int resolveConstructors(_) { | 335 int resolveConstructors(_) { |
336 int count = 0; | 336 int count = 0; |
337 members.forEach((String name, Builder member) { | 337 members.forEach((String name, Builder member) { |
338 count += member.resolveConstructors(this); | 338 count += member.resolveConstructors(this); |
339 }); | 339 }); |
340 return count; | 340 return count; |
341 } | 341 } |
342 } | 342 } |
OLD | NEW |