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

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

Issue 2952873002: In strong mode, properly infer the return types of setters as `void` (Closed)
Patch Set: Created 3 years, 6 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_procedure_builder; 5 library fasta.kernel_procedure_builder;
6 6
7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' 7 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
8 show KernelProcedure; 8 show KernelProcedure;
9 9
10 import 'package:front_end/src/fasta/source/source_library_builder.dart' 10 import 'package:front_end/src/fasta/source/source_library_builder.dart'
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 actualAsyncModifier = newModifier; 240 actualAsyncModifier = newModifier;
241 if (function != null) { 241 if (function != null) {
242 // No parent, it's an enum. 242 // No parent, it's an enum.
243 function.asyncMarker = actualAsyncModifier; 243 function.asyncMarker = actualAsyncModifier;
244 function.dartAsyncMarker = actualAsyncModifier; 244 function.dartAsyncMarker = actualAsyncModifier;
245 } 245 }
246 } 246 }
247 247
248 bool get isEligibleForTopLevelInference { 248 bool get isEligibleForTopLevelInference {
249 if (!isInstanceMember) return false; 249 if (!isInstanceMember) return false;
250 if (returnType == null) { 250 if (returnType == null) return true;
251 // For now, we skip inferred return types of setters.
252 // TODO(paulberry): fix this.
253 if (!isSetter) return true;
254 }
255 if (formals != null) { 251 if (formals != null) {
256 for (var formal in formals) { 252 for (var formal in formals) {
257 if (formal.type == null) return true; 253 if (formal.type == null) return true;
258 } 254 }
259 } 255 }
260 return false; 256 return false;
261 } 257 }
262 258
263 Procedure build(SourceLibraryBuilder library) { 259 Procedure build(SourceLibraryBuilder library) {
264 // TODO(ahe): I think we may call this twice on parts. Investigate. 260 // TODO(ahe): I think we may call this twice on parts. Investigate.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 406 }
411 } 407 }
412 initializers.add(initializer..parent = constructor); 408 initializers.add(initializer..parent = constructor);
413 initializers.add(superInitializer); 409 initializers.add(superInitializer);
414 return; 410 return;
415 } 411 }
416 initializers.add(initializer); 412 initializers.add(initializer);
417 initializer.parent = constructor; 413 initializer.parent = constructor;
418 } 414 }
419 } 415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698