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

Unified Diff: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart

Issue 1151163004: Implementation of null-aware operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/compiler/lib/src/inferrer/simple_types_inferrer.dart
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
index f321037e7859e8a63e9e2fb2248fc5ad3415074d..22bf18c3861f5bf3490863e6d7146512dff1b0d1 100644
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
@@ -155,7 +155,8 @@ class TypeMaskSystem implements TypeSystem<TypeMask> {
return type != selector.mask;
}
- TypeMask refineReceiver(Selector selector, TypeMask receiverType) {
+ TypeMask refineReceiver(Selector selector, TypeMask receiverType,
+ bool isConditional) {
TypeMask newType = compiler.world.allFunctions.receiverType(selector);
return receiverType.intersection(newType, classWorld);
}
@@ -1759,6 +1760,15 @@ class SimpleTypeInferrerVisitor<T>
}
@override
+ T visitIfNotNullDynamicPropertyGet(
+ ast.Send node,
+ ast.Node receiver,
+ Selector selector,
+ _) {
+ return handleDynamicGet(node);
+ }
+
+ @override
T visitLocalVariableGet(
ast.Send node,
LocalVariableElement variable,
@@ -1943,12 +1953,14 @@ class SimpleTypeInferrerVisitor<T>
// If the receiver of the call is a local, we may know more about
// its type by refining it with the potential targets of the
// calls.
- if (node.asSend() != null) {
- ast.Node receiver = node.asSend().receiver;
+ ast.Send send = node.asSend();
+ if (send != null) {
+ ast.Node receiver = send.receiver;
if (receiver != null) {
Element element = elements[receiver];
if (Elements.isLocal(element) && !capturedVariables.contains(element)) {
- T refinedType = types.refineReceiver(selector, receiverType);
+ T refinedType = types.refineReceiver(selector, receiverType,
+ send.isConditional);
locals.update(element, refinedType, node);
}
}
« no previous file with comments | « pkg/compiler/lib/src/inferrer/inferrer_visitor.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698