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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 575 |
576 final Map<String, Builder> setters; | 576 final Map<String, Builder> setters; |
577 | 577 |
578 final List<T> types = <T>[]; | 578 final List<T> types = <T>[]; |
579 | 579 |
580 String name; | 580 String name; |
581 | 581 |
582 final Map<ProcedureBuilder, DeclarationBuilder<T>> factoryDeclarations; | 582 final Map<ProcedureBuilder, DeclarationBuilder<T>> factoryDeclarations; |
583 | 583 |
584 DeclarationBuilder(this.members, this.setters, this.constructors, | 584 DeclarationBuilder(this.members, this.setters, this.constructors, |
585 this.factoryDeclarations, this.name, this.parent); | 585 this.factoryDeclarations, this.name, this.parent) { |
| 586 assert(name != null); |
| 587 } |
586 | 588 |
587 DeclarationBuilder.library() | 589 DeclarationBuilder.library() |
588 : this(<String, Builder>{}, <String, Builder>{}, null, null, null, null); | 590 : this(<String, Builder>{}, <String, Builder>{}, null, null, "library", |
| 591 null); |
589 | 592 |
590 DeclarationBuilder createNested(String name, bool hasMembers) { | 593 DeclarationBuilder createNested(String name, bool hasMembers) { |
591 return new DeclarationBuilder<T>( | 594 return new DeclarationBuilder<T>( |
592 hasMembers ? <String, MemberBuilder>{} : null, | 595 hasMembers ? <String, MemberBuilder>{} : null, |
593 hasMembers ? <String, MemberBuilder>{} : null, | 596 hasMembers ? <String, MemberBuilder>{} : null, |
594 hasMembers ? <String, MemberBuilder>{} : null, | 597 hasMembers ? <String, MemberBuilder>{} : null, |
595 <ProcedureBuilder, DeclarationBuilder<T>>{}, | 598 <ProcedureBuilder, DeclarationBuilder<T>>{}, |
596 name, | 599 name, |
597 this); | 600 this); |
598 } | 601 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 | 657 |
655 /// Called to register [procedure] as a factory whose types are collected in | 658 /// Called to register [procedure] as a factory whose types are collected in |
656 /// [factoryDeclaration]. Later, once the class has been built, we can | 659 /// [factoryDeclaration]. Later, once the class has been built, we can |
657 /// synthesize type variables on the factory matching the class'. | 660 /// synthesize type variables on the factory matching the class'. |
658 void addFactoryDeclaration( | 661 void addFactoryDeclaration( |
659 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 662 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
660 factoryDeclarations[procedure] = factoryDeclaration; | 663 factoryDeclarations[procedure] = factoryDeclaration; |
661 } | 664 } |
662 | 665 |
663 Scope toScope(Scope parent) { | 666 Scope toScope(Scope parent) { |
664 return new Scope(members, setters, parent, isModifiable: false); | 667 return new Scope(members, setters, parent, name, isModifiable: false); |
665 } | 668 } |
666 } | 669 } |
OLD | NEW |