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

Unified Diff: pkg/compiler/lib/src/inferrer/type_graph_nodes.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/type_graph_nodes.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index a12b342145f15d65d25da6cbb76c312ce0f64a07..c77f169cb1e1a9ac6fe275f830364bc8822738e3 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -897,7 +897,7 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
// Walk over the found targets, and compute the joined union type mask
// for all these targets.
- return inferrer.types.joinTypeMasks(targets.map((element) {
+ TypeMask result = inferrer.types.joinTypeMasks(targets.map((element) {
// If [canReachAll] is true, then we are iterating over all
// targets that satisfy the untyped selector. We skip the return
// type of the targets that can only be reached through
@@ -942,6 +942,15 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
return inferrer.typeOfElementWithSelector(element, typedSelector).type;
}
}));
+
+ if (call is ast.Send) {
+ Send send = call;
+ if (send.isConditional && receiver.type.isNullable) {
+ // Conditional sends (e.g. `a?.b`) may be null if the receiver is null.
+ result = result.nullable();
+ }
+ }
+ return result;
}
void giveUp(TypeGraphInferrerEngine inferrer, {bool clearAssignments: true}) {
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698