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

Unified Diff: lib/type_checker.dart

Issue 2465263002: Always store the type of a conditional expression on the node. (Closed)
Patch Set: Update test expectation Created 4 years, 1 month 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 | « lib/frontend/accessors.dart ('k') | testcases/input/null_aware.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/type_checker.dart
diff --git a/lib/type_checker.dart b/lib/type_checker.dart
index 0755e6e6f6ee4a03ea1d12e9704fe808b6f6da9e..4ebc31a15403c772a9eecd313a7cba81d915c031 100644
--- a/lib/type_checker.dart
+++ b/lib/type_checker.dart
@@ -319,17 +319,9 @@ class TypeCheckingVisitor
@override
DartType visitConditionalExpression(ConditionalExpression node) {
checkAssignableExpression(node.condition, environment.boolType);
- if (node.staticType == null) {
- var thenType = visitExpression(node.then);
- var otherwiseType = visitExpression(node.otherwise);
- if (thenType is BottomType) return otherwiseType;
- if (otherwiseType is BottomType) return thenType;
- return const DynamicType();
- } else {
- checkAssignableExpression(node.then, node.staticType);
- checkAssignableExpression(node.otherwise, node.staticType);
- return node.staticType;
- }
+ checkAssignableExpression(node.then, node.staticType);
+ checkAssignableExpression(node.otherwise, node.staticType);
+ return node.staticType;
}
@override
« no previous file with comments | « lib/frontend/accessors.dart ('k') | testcases/input/null_aware.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698