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

Unified Diff: compiler/java/com/google/dart/compiler/ast/LibraryUnit.java

Issue 8913016: Issue 839: Bad code leading to top level methods being something other than identifier (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Nits Created 9 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: compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
diff --git a/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java b/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
index a5f4e33fb21d120314cafd5efe08bef2b6071310..00c24c92ae583852c8b12e97491072aecc76d115 100644
--- a/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
+++ b/compiler/java/com/google/dart/compiler/ast/LibraryUnit.java
@@ -308,8 +308,13 @@ public class LibraryUnit {
public Void visitMethodDefinition(DartMethodDefinition node) {
// Method names are always identifiers, except for factories, which cannot appear
// in this context.
- DartIdentifier name = (DartIdentifier) node.getName();
- topLevelNodes.put(name.getTargetName(), node);
+ DartExpression name = node.getName();
+ if(name instanceof DartIdentifier) {
+ topLevelNodes.put(((DartIdentifier) name).getTargetName(), node);
+ } else {
+ // Visit the unknown node to generate a string for our use.
+ topLevelNodes.put(node.getName().toSource(), node);
+ }
return null;
}

Powered by Google App Engine
This is Rietveld 408576698