| 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 AsyncMarker, ProcedureKind; | 7 import 'package:kernel/ast.dart' show AsyncMarker, ProcedureKind; |
| 8 | 8 |
| 9 import '../combinator.dart' show Combinator; | 9 import '../combinator.dart' show Combinator; |
| 10 | 10 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 } | 327 } |
| 328 if (exporters.isNotEmpty) { | 328 if (exporters.isNotEmpty) { |
| 329 Export export = exporters.first; | 329 Export export = exporters.first; |
| 330 inputError( | 330 inputError( |
| 331 export.fileUri, export.charOffset, "A part can't be exported."); | 331 export.fileUri, export.charOffset, "A part can't be exported."); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 void includeParts() { | 335 void includeParts() { |
| 336 for (SourceLibraryBuilder<T, R> part in parts.toList()) { | 336 for (SourceLibraryBuilder<T, R> part in parts.toList()) { |
| 337 includePart(part); | 337 if (part == this) { |
| 338 addCompileTimeError(-1, "A file can't be a part of itself."); |
| 339 } else { |
| 340 includePart(part); |
| 341 } |
| 338 } | 342 } |
| 339 } | 343 } |
| 340 | 344 |
| 341 void includePart(SourceLibraryBuilder<T, R> part) { | 345 void includePart(SourceLibraryBuilder<T, R> part) { |
| 342 if (name != null) { | 346 if (name != null) { |
| 343 if (part.partOf == null) { | 347 if (part.partOf == null) { |
| 344 warning( | 348 warning( |
| 345 part.fileUri, | 349 part.fileUri, |
| 346 -1, | 350 -1, |
| 347 "Has no 'part of' declaration but is used as " | 351 "Has no 'part of' declaration but is used as " |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 518 } |
| 515 | 519 |
| 516 /// Called to register [procedure] as a factory whose types are collected in | 520 /// Called to register [procedure] as a factory whose types are collected in |
| 517 /// [factoryDeclaration]. Later, once the class has been built, we can | 521 /// [factoryDeclaration]. Later, once the class has been built, we can |
| 518 /// synthesize type variables on the factory matching the class'. | 522 /// synthesize type variables on the factory matching the class'. |
| 519 void addFactoryDeclaration( | 523 void addFactoryDeclaration( |
| 520 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 524 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
| 521 factoryDeclarations[procedure] = factoryDeclaration; | 525 factoryDeclarations[procedure] = factoryDeclaration; |
| 522 } | 526 } |
| 523 } | 527 } |
| OLD | NEW |