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

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

Issue 2956723002: Implement inference tests for logical operators. (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
« 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 a9047a149e07fc01e3416c6b091bf396fc01e061..aab7e7a964fccf8b38ef2b44aba26153d82eeea2 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
@@ -1074,8 +1074,14 @@ class KernelLogicalExpression extends LogicalExpression
@override
DartType _inferExpression(
KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
- // TODO(scheglov): implement.
- return typeNeeded ? const DynamicType() : null;
+ typeNeeded = inferrer.listener.logicalExpressionEnter(this, typeContext) ||
+ typeNeeded;
+ var boolType = inferrer.coreTypes.boolClass.rawType;
+ inferrer.inferExpression(left, boolType, false);
+ inferrer.inferExpression(right, boolType, false);
+ var inferredType = typeNeeded ? boolType : null;
+ inferrer.listener.logicalExpressionExit(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