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

Unified Diff: pkg/compiler/lib/src/scanner/listener.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
« no previous file with comments | « pkg/compiler/lib/src/scanner/array_based_scanner.dart ('k') | pkg/compiler/lib/src/scanner/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/scanner/listener.dart
diff --git a/pkg/compiler/lib/src/scanner/listener.dart b/pkg/compiler/lib/src/scanner/listener.dart
index bc3a116ec8cd6cbbe35094dca52f134f660a5770..cd747b942560cce8e9d8fd3307a1a69227d6c4b1 100644
--- a/pkg/compiler/lib/src/scanner/listener.dart
+++ b/pkg/compiler/lib/src/scanner/listener.dart
@@ -746,6 +746,9 @@ class Listener {
break;
}
reportError(token, kind, arguments);
+ } else if (token is UnsupportedNullAwareToken) {
+ reportError(token, MessageKind.NULL_AWARE_OPERATORS_DISABLED,
+ {'operator' : token.operator});
} else if (token is UnmatchedToken) {
String begin = token.begin.value;
String end = closeBraceFor(begin);
@@ -1568,7 +1571,7 @@ class NodeListener extends ElementListener {
if (name.asSend() == null) {
name = new Send(thisIdentifier, name);
} else {
- name = name.asSend().copyWithReceiver(thisIdentifier);
+ name = name.asSend().copyWithReceiver(thisIdentifier, false);
}
}
TypeAnnotation type = popNode();
@@ -1698,7 +1701,9 @@ class NodeListener extends ElementListener {
Node argument = popNode();
Node receiver = popNode();
String tokenString = token.stringValue;
- if (identical(tokenString, '.') || identical(tokenString, '..')) {
+ if (identical(tokenString, '.') ||
+ identical(tokenString, '..') ||
+ identical(tokenString, '?.')) {
Send argumentSend = argument.asSend();
if (argumentSend == null) {
// TODO(ahe): The parser should diagnose this problem, not
@@ -1708,7 +1713,8 @@ class NodeListener extends ElementListener {
}
if (argumentSend.receiver != null) internalError(node: argument);
if (argument is SendSet) internalError(node: argument);
- pushNode(argument.asSend().copyWithReceiver(receiver));
+ pushNode(argument.asSend().copyWithReceiver(receiver,
+ identical(tokenString, '?.')));
} else {
NodeList arguments = new NodeList.singleton(argument);
pushNode(new Send(receiver, new Operator(token), arguments));
@@ -1755,7 +1761,8 @@ class NodeListener extends ElementListener {
arguments = new NodeList.singleton(arg);
}
Operator op = new Operator(token);
- pushNode(new SendSet(send.receiver, send.selector, op, arguments));
+ pushNode(new SendSet(send.receiver, send.selector, op, arguments,
+ send.isConditional));
}
void reportNotAssignable(Node node) {
@@ -1922,9 +1929,11 @@ class NodeListener extends ElementListener {
Operator op = new Operator(token);
if (isPrefix) {
- pushNode(new SendSet.prefix(send.receiver, send.selector, op, argument));
+ pushNode(new SendSet.prefix(send.receiver, send.selector, op, argument,
+ send.isConditional));
} else {
- pushNode(new SendSet.postfix(send.receiver, send.selector, op, argument));
+ pushNode(new SendSet.postfix(send.receiver, send.selector, op, argument,
+ send.isConditional));
}
}
« no previous file with comments | « pkg/compiler/lib/src/scanner/array_based_scanner.dart ('k') | pkg/compiler/lib/src/scanner/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698