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 |
11 import '../combinator.dart' show | 11 import '../combinator.dart' show |
12 Combinator; | 12 Combinator; |
13 | 13 |
14 import '../errors.dart' show | 14 import '../errors.dart' show |
15 internalError; | 15 internalError; |
16 | 16 |
| 17 import '../messages.dart' show |
| 18 warning; |
| 19 |
17 import '../import.dart' show | 20 import '../import.dart' show |
18 Import; | 21 Import; |
19 | 22 |
20 import 'source_loader.dart' show | 23 import 'source_loader.dart' show |
21 SourceLoader; | 24 SourceLoader; |
22 | 25 |
23 import '../builder/scope.dart' show | 26 import '../builder/scope.dart' show |
24 Scope; | 27 Scope; |
25 | 28 |
26 import '../builder/builder.dart' show | 29 import '../builder/builder.dart' show |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 298 |
296 void includeParts() { | 299 void includeParts() { |
297 for (SourceLibraryBuilder<T, R> part in parts.toList()) { | 300 for (SourceLibraryBuilder<T, R> part in parts.toList()) { |
298 includePart(part); | 301 includePart(part); |
299 } | 302 } |
300 } | 303 } |
301 | 304 |
302 void includePart(SourceLibraryBuilder<T, R> part) { | 305 void includePart(SourceLibraryBuilder<T, R> part) { |
303 if (name != null) { | 306 if (name != null) { |
304 if (part.partOf == null) { | 307 if (part.partOf == null) { |
305 print("${part.uri} has no 'part of' declaration but is used as a part " | 308 warning(part.fileUri, -1, "Has no 'part of' declaration but is used as " |
306 "by ${name} ($uri)"); | 309 "a part by ${name} ($uri)."); |
307 parts.remove(part); | 310 parts.remove(part); |
308 return; | 311 return; |
309 } | 312 } |
310 if (part.partOf != name) { | 313 if (part.partOf != name) { |
311 print("${part.uri} is part of '${part.partOf}' but is used as a part " | 314 warning(part.fileUri, -1, "Is part of '${part.partOf}' but is used as " |
312 "by '${name}' ($uri)"); | 315 "a part by '${name}' ($uri)."); |
313 parts.remove(part); | 316 parts.remove(part); |
314 return; | 317 return; |
315 } | 318 } |
316 } | 319 } |
317 part.members.forEach((String name, Builder builder) { | 320 part.members.forEach((String name, Builder builder) { |
318 if (builder.next != null) { | 321 if (builder.next != null) { |
319 assert(builder.next.next == null); | 322 assert(builder.next.next == null); |
320 addBuilder(name, builder.next, builder.next.charOffset); | 323 addBuilder(name, builder.next, builder.next.charOffset); |
321 } | 324 } |
322 addBuilder(name, builder, builder.charOffset); | 325 addBuilder(name, builder, builder.charOffset); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 } | 472 } |
470 | 473 |
471 /// Called to register [procedure] as a factory whose types are collected in | 474 /// Called to register [procedure] as a factory whose types are collected in |
472 /// [factoryDeclaration]. Later, once the class has been built, we can | 475 /// [factoryDeclaration]. Later, once the class has been built, we can |
473 /// synthesize type variables on the factory matching the class'. | 476 /// synthesize type variables on the factory matching the class'. |
474 void addFactoryDeclaration( | 477 void addFactoryDeclaration( |
475 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 478 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
476 factoryDeclarations[procedure] = factoryDeclaration; | 479 factoryDeclarations[procedure] = factoryDeclaration; |
477 } | 480 } |
478 } | 481 } |
OLD | NEW |