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

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

Issue 2935763004: Implement type inference for "not" expressions. (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 d7a6e08773506db04b2cad3f8b7b518dc96bc474..c9f70553c2adb14c57d0dd8c56cd76d2f8f79e43 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
@@ -1301,14 +1301,20 @@ class KernelNot extends Not implements KernelExpression {
@override
void _collectDependencies(KernelDependencyCollector collector) {
- // No inference dependencies.
+ collector.collectDependencies(operand);
}
@override
DartType _inferExpression(
KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
- // TODO(scheglov): implement.
- return typeNeeded ? const DynamicType() : null;
+ typeNeeded = inferrer.listener.notEnter(this, typeContext) || typeNeeded;
+ // First infer the receiver so we can look up the method that was invoked.
+ inferrer.inferExpression(
+ operand, inferrer.coreTypes.boolClass.rawType, false);
scheglov 2017/06/12 23:29:28 Maybe extract boolType into a local variable.
Paul Berry 2017/06/13 00:39:54 Done.
+ DartType inferredType =
+ typeNeeded ? inferrer.coreTypes.boolClass.rawType : null;
+ inferrer.listener.notExit(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