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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index 6e35f2bb3faab50a1be03b25d1b652ed71ef01cb..05ab9f60e3694907eb77093ee2aec8807f0b294f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -1518,6 +1518,17 @@ class KernelProcedure extends Procedure implements KernelMember {
static bool hasImplicitReturnType(KernelProcedure procedure) {
return procedure._hasImplicitReturnType;
}
+
+ static void inferSetterReturnType(
+ KernelProcedure procedure, TypeInferenceEngineImpl engine, String uri) {
+ assert(procedure.isSetter);
+ if (procedure._hasImplicitReturnType) {
+ var inferredType = const VoidType();
+ engine.instrumentation?.record(Uri.parse(uri), procedure.fileOffset,
+ 'topType', new InstrumentationValueForType(inferredType));
+ procedure.function?.returnType = inferredType;
+ }
+ }
}
/// Concrete shadow object representing an assignment to a property.

Powered by Google App Engine
This is Rietveld 408576698