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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart

Issue 11464026: Diagnose illegal lvalues better. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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: dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart b/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
index 687cec8ea120da5f7377f3b3130f692ef6d4fa79..ac001450cf8bae784a51407d94472efe0b883965 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
@@ -1369,8 +1369,11 @@ class NodeListener extends ElementListener {
Node arg = popNode();
Node node = popNode();
Send send = node.asSend();
- if (send == null) internalError(node: node);
- if (!(send.isPropertyAccess || send.isIndex)) internalError(node: send);
+ if (send == null || !(send.isPropertyAccess || send.isIndex)) {
+ // TODO(ahe): The parser should diagnose this problem, not this
+ // listener.
+ listener.cancel('Syntax error: Not assignable.', node: node);
+ }
if (send.asSendSet() != null) internalError(node: send);
NodeList arguments;
if (send.isIndex) {
@@ -1817,8 +1820,8 @@ class NodeListener extends ElementListener {
void internalError({Token token, Node node}) {
// TODO(ahe): This should call listener.internalError.
- listener.cancel('internal error', token: token, node: node);
- throw 'internal error';
+ Spannable spannable = (token == null) ? node : token;
+ throw new SpannableAssertionFailure(spannable, 'internal error in parser');
}
}

Powered by Google App Engine
This is Rietveld 408576698