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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart

Issue 2954693002: Add/fix/cleanup type inference for throw and rethrow. (Closed)
Patch Set: Add a clarifying comment 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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71f2b30b67e10b0059b217923d1396d2fcd81623..4ffa9b98af78b469cf19e30ffa76049341deac22 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
@@ -1535,8 +1535,11 @@ class KernelRethrow extends Rethrow implements KernelExpression {
@override
DartType _inferExpression(
KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
- // TODO(scheglov): implement.
- return typeNeeded ? const DynamicType() : null;
+ typeNeeded =
+ inferrer.listener.rethrowEnter(this, typeContext) || typeNeeded;
+ var inferredType = typeNeeded ? const BottomType() : null;
+ inferrer.listener.rethrowExit(this, inferredType);
+ return inferredType;
}
}
@@ -1824,8 +1827,11 @@ class KernelThrow extends Throw implements KernelExpression {
@override
DartType _inferExpression(
KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
+ typeNeeded = inferrer.listener.throwEnter(this, typeContext) || typeNeeded;
inferrer.inferExpression(expression, null, false);
- return typeNeeded ? const BottomType() : null;
+ var inferredType = typeNeeded ? const BottomType() : null;
+ inferrer.listener.throwExit(this, inferredType);
+ return inferredType;
}
}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698