| 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 |
| 11 import '../errors.dart' show internalError; | 11 import '../errors.dart' show inputError, internalError; |
| 12 |
| 13 import '../export.dart' show Export; |
| 12 | 14 |
| 13 import '../messages.dart' show warning; | 15 import '../messages.dart' show warning; |
| 14 | 16 |
| 15 import '../import.dart' show Import; | 17 import '../import.dart' show Import; |
| 16 | 18 |
| 17 import 'source_loader.dart' show SourceLoader; | 19 import 'source_loader.dart' show SourceLoader; |
| 18 | 20 |
| 19 import '../builder/scope.dart' show Scope; | 21 import '../builder/scope.dart' show Scope; |
| 20 | 22 |
| 21 import '../builder/builder.dart' | 23 import '../builder/builder.dart' |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 315 } |
| 314 return null; | 316 return null; |
| 315 } | 317 } |
| 316 | 318 |
| 317 void addImplementationBuilder(String name, Builder builder, int charOffset) { | 319 void addImplementationBuilder(String name, Builder builder, int charOffset) { |
| 318 implementationBuilders.add([name, builder, charOffset]); | 320 implementationBuilders.add([name, builder, charOffset]); |
| 319 } | 321 } |
| 320 | 322 |
| 321 void validatePart() { | 323 void validatePart() { |
| 322 if (parts.isNotEmpty) { | 324 if (parts.isNotEmpty) { |
| 323 internalError("Part with parts: $uri"); | 325 inputError(fileUri, -1, |
| 326 "A file that's a part of a library can't have parts itself."); |
| 324 } | 327 } |
| 325 if (exporters.isNotEmpty) { | 328 if (exporters.isNotEmpty) { |
| 326 internalError( | 329 Export export = exporters.first; |
| 327 "${exporters.first.exporter.uri} attempts to export the part $uri."); | 330 inputError( |
| 331 export.fileUri, export.charOffset, "A part can't be exported."); |
| 328 } | 332 } |
| 329 } | 333 } |
| 330 | 334 |
| 331 void includeParts() { | 335 void includeParts() { |
| 332 for (SourceLibraryBuilder<T, R> part in parts.toList()) { | 336 for (SourceLibraryBuilder<T, R> part in parts.toList()) { |
| 333 includePart(part); | 337 includePart(part); |
| 334 } | 338 } |
| 335 } | 339 } |
| 336 | 340 |
| 337 void includePart(SourceLibraryBuilder<T, R> part) { | 341 void includePart(SourceLibraryBuilder<T, R> part) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 } | 514 } |
| 511 | 515 |
| 512 /// Called to register [procedure] as a factory whose types are collected in | 516 /// Called to register [procedure] as a factory whose types are collected in |
| 513 /// [factoryDeclaration]. Later, once the class has been built, we can | 517 /// [factoryDeclaration]. Later, once the class has been built, we can |
| 514 /// synthesize type variables on the factory matching the class'. | 518 /// synthesize type variables on the factory matching the class'. |
| 515 void addFactoryDeclaration( | 519 void addFactoryDeclaration( |
| 516 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 520 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
| 517 factoryDeclarations[procedure] = factoryDeclaration; | 521 factoryDeclarations[procedure] = factoryDeclaration; |
| 518 } | 522 } |
| 519 } | 523 } |
| OLD | NEW |