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

Unified Diff: lib/kernel_visitor.dart

Issue 2059733002: More bad for-in loop variables. (Closed) Base URL: git@github.com:dart-lang/rasta.git@parser_crash
Patch Set: Created 4 years, 6 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 | « no previous file | submodules.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/kernel_visitor.dart
diff --git a/lib/kernel_visitor.dart b/lib/kernel_visitor.dart
index c1f2bcc1c1cd6ddc56c8f7b1f56b036c0d95cde1..a7af44319826bf0d11c7e6a2d815313a757974b1 100644
--- a/lib/kernel_visitor.dart
+++ b/lib/kernel_visitor.dart
@@ -422,11 +422,15 @@ class KernelVisitor extends Object
Accessor computeAccessor(ForIn node, Element element) {
if (element == null) {
+ Send send = node.declaredIdentifier.asSend();
+ if (send == null) {
+ return new StaticAccessor(null, null);
+ }
// This should be the situation where `node.declaredIdentifier` is
// unresolved, but in an instance method context. If it is some different
// situation, the assignment to [ir.PropertyGet] should act as an
// assertion.
- ir.PropertyGet expression = node.declaredIdentifier.accept(this);
+ ir.PropertyGet expression = send.accept(this);
return PropertyAccessor.make(expression.receiver, expression.name);
} else if (kernel.isSyntheticError(element)) {
return new StaticAccessor(null, null);
@@ -447,7 +451,7 @@ class KernelVisitor extends Object
return new StaticAccessor(
member, (element.isFinal || element.isConst) ? null : member);
} else {
- throw internalError(node, "Unhandled for-in variable: $element");
+ return new StaticAccessor(null, null);
}
}
« no previous file with comments | « no previous file | submodules.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698