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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart

Issue 2795723003: Change signature of resolveConstructors. (Closed)
Patch Set: 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.kernel_class_builder; 5 library fasta.kernel_class_builder;
6 6
7 import 'package:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 show 8 show
9 Class, 9 Class,
10 Constructor, 10 Constructor,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 Supertype buildSupertype( 101 Supertype buildSupertype(
102 LibraryBuilder library, List<KernelTypeBuilder> arguments) { 102 LibraryBuilder library, List<KernelTypeBuilder> arguments) {
103 if (arguments != null) { 103 if (arguments != null) {
104 return new Supertype(cls, buildTypeArguments(library, arguments)); 104 return new Supertype(cls, buildTypeArguments(library, arguments));
105 } else { 105 } else {
106 return cls.asRawSupertype; 106 return cls.asRawSupertype;
107 } 107 }
108 } 108 }
109 109
110 int resolveConstructors(KernelLibraryBuilder library) { 110 @override
111 int resolveConstructors(LibraryBuilder library) {
111 int count = super.resolveConstructors(library); 112 int count = super.resolveConstructors(library);
112 if (count != 0) { 113 if (count != 0) {
113 // Copy keys to avoid concurrent modification error. 114 // Copy keys to avoid concurrent modification error.
114 List<String> names = members.keys.toList(); 115 List<String> names = members.keys.toList();
115 for (String name in names) { 116 for (String name in names) {
116 Builder builder = members[name]; 117 Builder builder = members[name];
117 if (builder is KernelProcedureBuilder && builder.isFactory) { 118 if (builder is KernelProcedureBuilder && builder.isFactory) {
118 // Compute the immediate redirection target, not the effective. 119 // Compute the immediate redirection target, not the effective.
119 ConstructorReferenceBuilder redirectionTarget = 120 ConstructorReferenceBuilder redirectionTarget =
120 builder.redirectionTarget; 121 builder.redirectionTarget;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // 156 //
156 // Where each c1 ... cn are an instance of [StaticGet] whose target is 157 // Where each c1 ... cn are an instance of [StaticGet] whose target is
157 // [constructor.target]. 158 // [constructor.target].
158 // 159 //
159 // TODO(ahe): Generate the correct factory body instead. 160 // TODO(ahe): Generate the correct factory body instead.
160 DillMemberBuilder constructorsField = 161 DillMemberBuilder constructorsField =
161 members.putIfAbsent("_redirecting#", () { 162 members.putIfAbsent("_redirecting#", () {
162 ListLiteral literal = new ListLiteral(<Expression>[]); 163 ListLiteral literal = new ListLiteral(<Expression>[]);
163 Name name = new Name("_redirecting#", library.library); 164 Name name = new Name("_redirecting#", library.library);
164 Field field = new Field(name, 165 Field field = new Field(name,
165 isStatic: true, 166 isStatic: true, initializer: literal, fileUri: cls.fileUri)
166 initializer: literal, 167 ..fileOffset = cls.fileOffset;
167 fileUri: cls.fileUri)..fileOffset = cls.fileOffset;
168 cls.addMember(field); 168 cls.addMember(field);
169 return new DillMemberBuilder(field, this); 169 return new DillMemberBuilder(field, this);
170 }); 170 });
171 Field field = constructorsField.target; 171 Field field = constructorsField.target;
172 ListLiteral literal = field.initializer; 172 ListLiteral literal = field.initializer;
173 literal.expressions 173 literal.expressions
174 .add(new StaticGet(constructor.target)..parent = literal); 174 .add(new StaticGet(constructor.target)..parent = literal);
175 } 175 }
176 176
177 void checkOverrides(ClassHierarchy hierarchy) { 177 void checkOverrides(ClassHierarchy hierarchy) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 "The method '$name::${declaredMember.name.name}' doesn't have " 262 "The method '$name::${declaredMember.name.name}' doesn't have "
263 "the named parameter '${interfaceNamedParameters.current.name}' " 263 "the named parameter '${interfaceNamedParameters.current.name}' "
264 "of overriden method '${interfaceMember.enclosingClass.name}::" 264 "of overriden method '${interfaceMember.enclosingClass.name}::"
265 "${interfaceMember.name.name}'."); 265 "${interfaceMember.name.name}'.");
266 break outer; 266 break outer;
267 } 267 }
268 } 268 }
269 } 269 }
270 } 270 }
271 } 271 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/class_builder.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