| 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 ProcedureKind; | 7 import 'package:kernel/ast.dart' show ProcedureKind; |
| 8 | 8 |
| 9 import '../../base/resolve_relative_uri.dart' show resolveRelativeUri; | 9 import '../../base/resolve_relative_uri.dart' show resolveRelativeUri; |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 templateMissingPartOf, | 47 templateMissingPartOf, |
| 48 templatePartOfLibraryNameMismatch, | 48 templatePartOfLibraryNameMismatch, |
| 49 templatePartOfUriMismatch, | 49 templatePartOfUriMismatch, |
| 50 templatePartOfUseUri, | 50 templatePartOfUseUri, |
| 51 templatePartTwice; | 51 templatePartTwice; |
| 52 | 52 |
| 53 import '../import.dart' show Import; | 53 import '../import.dart' show Import; |
| 54 | 54 |
| 55 import '../problems.dart' show unhandled; | 55 import '../problems.dart' show unhandled; |
| 56 | 56 |
| 57 import '../util/relativize.dart' show relativizeUri; |
| 58 |
| 57 import 'source_loader.dart' show SourceLoader; | 59 import 'source_loader.dart' show SourceLoader; |
| 58 | 60 |
| 59 abstract class SourceLibraryBuilder<T extends TypeBuilder, R> | 61 abstract class SourceLibraryBuilder<T extends TypeBuilder, R> |
| 60 extends LibraryBuilder<T, R> { | 62 extends LibraryBuilder<T, R> { |
| 61 final SourceLoader loader; | 63 final SourceLoader loader; |
| 62 | 64 |
| 63 final DeclarationBuilder<T> libraryDeclaration; | 65 final DeclarationBuilder<T> libraryDeclaration; |
| 64 | 66 |
| 65 final List<ConstructorReferenceBuilder> constructorReferences = | 67 final List<ConstructorReferenceBuilder> constructorReferences = |
| 66 <ConstructorReferenceBuilder>[]; | 68 <ConstructorReferenceBuilder>[]; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 if (!explicitCoreImport) { | 519 if (!explicitCoreImport) { |
| 518 loader.coreLibrary.exportScope.forEach((String name, Builder member) { | 520 loader.coreLibrary.exportScope.forEach((String name, Builder member) { |
| 519 addToScope(name, member, -1, true); | 521 addToScope(name, member, -1, true); |
| 520 }); | 522 }); |
| 521 } | 523 } |
| 522 exportScope.forEach((String name, Builder member) { | 524 exportScope.forEach((String name, Builder member) { |
| 523 if (member.parent != this) { | 525 if (member.parent != this) { |
| 524 additionalExports ??= <List<String>>[]; | 526 additionalExports ??= <List<String>>[]; |
| 525 Builder parent = member.parent; | 527 Builder parent = member.parent; |
| 526 if (parent is LibraryBuilder) { | 528 if (parent is LibraryBuilder) { |
| 527 additionalExports.add(<String>["${parent.uri}", name]); | 529 additionalExports.add(<String>[ |
| 530 relativizeUri(parent.uri, base: uri.resolve(".")), |
| 531 name |
| 532 ]); |
| 528 } else { | 533 } else { |
| 529 InvalidTypeBuilder invalidType = member; | 534 InvalidTypeBuilder invalidType = member; |
| 530 String message = invalidType.message.message; | 535 String message = invalidType.message.message; |
| 531 additionalExports.add(<String>[null, name, message]); | 536 additionalExports.add(<String>[null, name, message]); |
| 532 } | 537 } |
| 533 } | 538 } |
| 534 }); | 539 }); |
| 535 } | 540 } |
| 536 | 541 |
| 537 @override | 542 @override |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 /// synthesize type variables on the factory matching the class'. | 682 /// synthesize type variables on the factory matching the class'. |
| 678 void addFactoryDeclaration( | 683 void addFactoryDeclaration( |
| 679 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 684 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
| 680 factoryDeclarations[procedure] = factoryDeclaration; | 685 factoryDeclarations[procedure] = factoryDeclaration; |
| 681 } | 686 } |
| 682 | 687 |
| 683 Scope toScope(Scope parent) { | 688 Scope toScope(Scope parent) { |
| 684 return new Scope(members, setters, parent, isModifiable: false); | 689 return new Scope(members, setters, parent, isModifiable: false); |
| 685 } | 690 } |
| 686 } | 691 } |
| OLD | NEW |