| 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:front_end/src/scanner/token.dart' show Token; | |
| 8 | |
| 9 import 'package:kernel/ast.dart' show ProcedureKind; | 7 import 'package:kernel/ast.dart' show ProcedureKind; |
| 10 | 8 |
| 11 import '../../base/resolve_relative_uri.dart' show resolveRelativeUri; | 9 import '../../base/resolve_relative_uri.dart' show resolveRelativeUri; |
| 12 | 10 |
| 13 import '../combinator.dart' show Combinator; | 11 import '../../scanner/token.dart' show Token; |
| 14 | |
| 15 import '../deprecated_problems.dart' | |
| 16 show deprecated_inputError, deprecated_internalProblem; | |
| 17 | |
| 18 import '../export.dart' show Export; | |
| 19 | |
| 20 import '../import.dart' show Import; | |
| 21 | |
| 22 import 'source_loader.dart' show SourceLoader; | |
| 23 | 12 |
| 24 import '../builder/builder.dart' | 13 import '../builder/builder.dart' |
| 25 show | 14 show |
| 26 Builder, | 15 Builder, |
| 27 ClassBuilder, | 16 ClassBuilder, |
| 28 ConstructorReferenceBuilder, | 17 ConstructorReferenceBuilder, |
| 29 FormalParameterBuilder, | 18 FormalParameterBuilder, |
| 30 FunctionTypeBuilder, | 19 FunctionTypeBuilder, |
| 31 LibraryBuilder, | 20 LibraryBuilder, |
| 32 MemberBuilder, | 21 MemberBuilder, |
| 33 MetadataBuilder, | 22 MetadataBuilder, |
| 34 NamedTypeBuilder, | 23 NamedTypeBuilder, |
| 35 PrefixBuilder, | 24 PrefixBuilder, |
| 36 ProcedureBuilder, | 25 ProcedureBuilder, |
| 37 Scope, | 26 Scope, |
| 38 TypeBuilder, | 27 TypeBuilder, |
| 39 TypeDeclarationBuilder, | 28 TypeDeclarationBuilder, |
| 40 TypeVariableBuilder, | 29 TypeVariableBuilder, |
| 41 Unhandled; | 30 Unhandled; |
| 42 | 31 |
| 32 import '../combinator.dart' show Combinator; |
| 33 |
| 34 import '../deprecated_problems.dart' show deprecated_inputError; |
| 35 |
| 36 import '../export.dart' show Export; |
| 37 |
| 38 import '../import.dart' show Import; |
| 39 |
| 40 import '../problems.dart' show unhandled; |
| 41 |
| 42 import 'source_loader.dart' show SourceLoader; |
| 43 |
| 43 abstract class SourceLibraryBuilder<T extends TypeBuilder, R> | 44 abstract class SourceLibraryBuilder<T extends TypeBuilder, R> |
| 44 extends LibraryBuilder<T, R> { | 45 extends LibraryBuilder<T, R> { |
| 45 final SourceLoader loader; | 46 final SourceLoader loader; |
| 46 | 47 |
| 47 final DeclarationBuilder<T> libraryDeclaration; | 48 final DeclarationBuilder<T> libraryDeclaration; |
| 48 | 49 |
| 49 final List<ConstructorReferenceBuilder> constructorReferences = | 50 final List<ConstructorReferenceBuilder> constructorReferences = |
| 50 <ConstructorReferenceBuilder>[]; | 51 <ConstructorReferenceBuilder>[]; |
| 51 | 52 |
| 52 final List<SourceLibraryBuilder<T, R>> parts = <SourceLibraryBuilder<T, R>>[]; | 53 final List<SourceLibraryBuilder<T, R>> parts = <SourceLibraryBuilder<T, R>>[]; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // implementation of MemberBuilder.isTopLevel to test explicitly for a | 277 // implementation of MemberBuilder.isTopLevel to test explicitly for a |
| 277 // LibraryBuilder. | 278 // LibraryBuilder. |
| 278 if (currentDeclaration == libraryDeclaration) { | 279 if (currentDeclaration == libraryDeclaration) { |
| 279 if (builder is MemberBuilder) { | 280 if (builder is MemberBuilder) { |
| 280 builder.parent = this; | 281 builder.parent = this; |
| 281 } else if (builder is TypeDeclarationBuilder) { | 282 } else if (builder is TypeDeclarationBuilder) { |
| 282 builder.parent = this; | 283 builder.parent = this; |
| 283 } else if (builder is PrefixBuilder) { | 284 } else if (builder is PrefixBuilder) { |
| 284 assert(builder.parent == this); | 285 assert(builder.parent == this); |
| 285 } else { | 286 } else { |
| 286 return deprecated_internalProblem("Unhandled: ${builder.runtimeType}"); | 287 return unhandled( |
| 288 "${builder.runtimeType}", "addBuilder", charOffset, fileUri); |
| 287 } | 289 } |
| 288 } else { | 290 } else { |
| 289 assert(currentDeclaration.parent == libraryDeclaration); | 291 assert(currentDeclaration.parent == libraryDeclaration); |
| 290 } | 292 } |
| 291 bool isConstructor = builder is ProcedureBuilder && | 293 bool isConstructor = builder is ProcedureBuilder && |
| 292 (builder.isConstructor || builder.isFactory); | 294 (builder.isConstructor || builder.isFactory); |
| 293 Map<String, Builder> members = isConstructor | 295 Map<String, Builder> members = isConstructor |
| 294 ? currentDeclaration.constructors | 296 ? currentDeclaration.constructors |
| 295 : (builder.isSetter | 297 : (builder.isSetter |
| 296 ? currentDeclaration.setters | 298 ? currentDeclaration.setters |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 /// synthesize type variables on the factory matching the class'. | 634 /// synthesize type variables on the factory matching the class'. |
| 633 void addFactoryDeclaration( | 635 void addFactoryDeclaration( |
| 634 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 636 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
| 635 factoryDeclarations[procedure] = factoryDeclaration; | 637 factoryDeclarations[procedure] = factoryDeclaration; |
| 636 } | 638 } |
| 637 | 639 |
| 638 Scope toScope(Scope parent) { | 640 Scope toScope(Scope parent) { |
| 639 return new Scope(members, setters, parent, isModifiable: false); | 641 return new Scope(members, setters, parent, isModifiable: false); |
| 640 } | 642 } |
| 641 } | 643 } |
| OLD | NEW |