| 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 String name; | 65 String name; |
| 66 | 66 |
| 67 String partOf; | 67 String partOf; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if (parts.isNotEmpty) { | 228 if (parts.isNotEmpty) { |
| 229 internalError("Part with parts: $uri"); | 229 internalError("Part with parts: $uri"); |
| 230 } | 230 } |
| 231 if (exporters.isNotEmpty) { | 231 if (exporters.isNotEmpty) { |
| 232 internalError( | 232 internalError( |
| 233 "${exporters.first.exporter.uri} attempts to export the part $uri."); | 233 "${exporters.first.exporter.uri} attempts to export the part $uri."); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 void includeParts() { | 237 void includeParts() { |
| 238 for (LibraryBuilder part in parts.toList()) { | 238 for (SourceLibraryBuilder<T, R> part in parts.toList()) { |
| 239 includePart(part); | 239 includePart(part); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 void includePart(SourceLibraryBuilder part) { | 243 void includePart(SourceLibraryBuilder<T, R> part) { |
| 244 if (name != null) { | 244 if (name != null) { |
| 245 if (part.partOf == null) { | 245 if (part.partOf == null) { |
| 246 print("${part.uri} has no 'part of' declaration but is used as a part " | 246 print("${part.uri} has no 'part of' declaration but is used as a part " |
| 247 "by ${name} ($uri)"); | 247 "by ${name} ($uri)"); |
| 248 parts.remove(part); | 248 parts.remove(part); |
| 249 return; | 249 return; |
| 250 } | 250 } |
| 251 if (part.partOf != name) { | 251 if (part.partOf != name) { |
| 252 print("${part.uri} is part of '${part.partOf}' but is used as a part " | 252 print("${part.uri} is part of '${part.partOf}' but is used as a part " |
| 253 "by '${name}' ($uri)"); | 253 "by '${name}' ($uri)"); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 325 } |
| 326 | 326 |
| 327 int resolveConstructors(_) { | 327 int resolveConstructors(_) { |
| 328 int count = 0; | 328 int count = 0; |
| 329 members.forEach((String name, Builder member) { | 329 members.forEach((String name, Builder member) { |
| 330 count += member.resolveConstructors(this); | 330 count += member.resolveConstructors(this); |
| 331 }); | 331 }); |
| 332 return count; | 332 return count; |
| 333 } | 333 } |
| 334 } | 334 } |
| OLD | NEW |