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

Unified Diff: pkg/compiler/lib/src/elements/elements.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/elements/elements.dart
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index 6dab617092caeaa3eedb7790dd9680afcd9fd7cd..e4c0ab5f99efba2d144a94b700d510b7c59ed6a1 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -532,7 +532,8 @@ class Elements {
static bool isInstanceSend(Send send, TreeElements elements) {
Element element = elements[send];
if (element == null) return !isClosureSend(send, element);
- return isInstanceMethod(element) || isInstanceField(element);
+ return isInstanceMethod(element) || isInstanceField(element)
+ || send.isConditional;
Siggi Cherem (dart-lang) 2015/05/22 03:50:49 this is because `A?.foo` is equivalent to `(A).foo
Johnni Winther 2015/05/22 12:39:48 Ack. Format like this: return isInstanceMethod(el
Siggi Cherem (dart-lang) 2015/05/22 19:49:54 Done.
}
static bool isClosureSend(Send send, Element element) {
@@ -640,7 +641,7 @@ class Elements {
static String constructOperatorNameOrNull(String op, bool isUnary) {
if (isMinusOperator(op)) {
return isUnary ? 'unary-' : op;
- } else if (isUserDefinableOperator(op)) {
+ } else if (isUserDefinableOperator(op) || op == '??') {
return op;
} else {
return null;
@@ -666,6 +667,7 @@ class Elements {
if (identical(op, '&=')) return '&';
if (identical(op, '^=')) return '^';
if (identical(op, '|=')) return '|';
+ if (identical(op, '??=')) return '??';
return null;
}

Powered by Google App Engine
This is Rietveld 408576698