Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: pkg/front_end/lib/src/fasta/source/source_class_builder.dart

Issue 2788913002: Prepare for separate setter scope. (Closed)
Patch Set: Address comments. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_class_builder; 5 library fasta.source_class_builder;
6 6
7 import 'package:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 show Class, Constructor, Supertype, TreeNode, setParents; 8 show Class, Constructor, Supertype, TreeNode, setParents;
9 9
10 import '../errors.dart' show internalError; 10 import '../errors.dart' show internalError;
(...skipping 24 matching lines...) Expand all
35 cls.fileUri ??= relativizeUri(parent.fileUri); 35 cls.fileUri ??= relativizeUri(parent.fileUri);
36 if (cls.fileOffset == TreeNode.noOffset) { 36 if (cls.fileOffset == TreeNode.noOffset) {
37 cls.fileOffset = charOffset; 37 cls.fileOffset = charOffset;
38 } 38 }
39 return cls; 39 return cls;
40 } 40 }
41 41
42 class SourceClassBuilder extends KernelClassBuilder { 42 class SourceClassBuilder extends KernelClassBuilder {
43 final Class cls; 43 final Class cls;
44 44
45 @override
45 final Map<String, Builder> constructors; 46 final Map<String, Builder> constructors;
46 47
47 final Map<String, Builder> membersInScope; 48 final Map<String, Builder> membersInScope;
48 49
49 final List<ConstructorReferenceBuilder> constructorReferences; 50 final List<ConstructorReferenceBuilder> constructorReferences;
50 51
51 final KernelTypeBuilder mixedInType; 52 final KernelTypeBuilder mixedInType;
52 53
53 SourceClassBuilder( 54 SourceClassBuilder(
54 List<MetadataBuilder> metadata, 55 List<MetadataBuilder> metadata,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // TODO(ahe): Report an error if supertype is null. 113 // TODO(ahe): Report an error if supertype is null.
113 cls.implementedTypes.add(supertype); 114 cls.implementedTypes.add(supertype);
114 } 115 }
115 } 116 }
116 } 117 }
117 118
118 cls.procedures.sort(compareProcedures); 119 cls.procedures.sort(compareProcedures);
119 return cls; 120 return cls;
120 } 121 }
121 122
122 Builder findConstructorOrFactory(String name) => constructors[name];
123
124 void addSyntheticConstructor(Constructor constructor) { 123 void addSyntheticConstructor(Constructor constructor) {
125 String name = constructor.name.name; 124 String name = constructor.name.name;
126 cls.constructors.add(constructor); 125 cls.constructors.add(constructor);
127 constructor.parent = cls; 126 constructor.parent = cls;
128 DillMemberBuilder memberBuilder = new DillMemberBuilder(constructor, this); 127 DillMemberBuilder memberBuilder = new DillMemberBuilder(constructor, this);
129 memberBuilder.next = constructors[name]; 128 memberBuilder.next = constructors[name];
130 constructors[name] = memberBuilder; 129 constructors[name] = memberBuilder;
131 } 130 }
132 } 131 }
133 132
(...skipping 11 matching lines...) Expand all
145 Map<String, Builder> computeConstructors(Map<String, Builder> members) { 144 Map<String, Builder> computeConstructors(Map<String, Builder> members) {
146 Map<String, Builder> constructors = <String, Builder>{}; 145 Map<String, Builder> constructors = <String, Builder>{};
147 members.forEach((String name, Builder builder) { 146 members.forEach((String name, Builder builder) {
148 if (builder is ProcedureBuilder && 147 if (builder is ProcedureBuilder &&
149 (builder.isConstructor || builder.isFactory)) { 148 (builder.isConstructor || builder.isFactory)) {
150 constructors[name] = builder; 149 constructors[name] = builder;
151 } 150 }
152 }); 151 });
153 return constructors; 152 return constructors;
154 } 153 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/scope_listener.dart ('k') | pkg/front_end/lib/src/fasta/source/source_library_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698