Chromium Code Reviews| Index: lib/compiler/implementation/elements/elements.dart |
| diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart |
| index 9877fe7daba1d0560bf357351123c8c6eca62e66..9395c2f3507a9ca3e9c6b42a7d5fec8b44cd92cd 100644 |
| --- a/lib/compiler/implementation/elements/elements.dart |
| +++ b/lib/compiler/implementation/elements/elements.dart |
| @@ -246,12 +246,12 @@ class Element implements Spannable { |
| int hashCode() => name === null ? 0 : name.hashCode(); |
| CompilationUnitElement getCompilationUnit() { |
| + if (this.isLibrary()) { |
|
ahe
2012/10/11 07:36:05
Perhaps this method should be overridden in Librar
floitsch
2012/10/11 13:58:12
Done.
|
| + LibraryElement library = this; |
| + return library.entryCompilationUnit; |
| + } |
| Element element = this; |
| - while (element !== null && !element.isCompilationUnit()) { |
| - if (element.isLibrary()) { |
| - LibraryElement library = element; |
| - return library.entryCompilationUnit; |
| - } |
| + while (!element.isCompilationUnit()) { |
|
ahe
2012/10/11 07:36:05
This will ensure a null error if something is setu
|
| element = element.enclosingElement; |
| } |
| return element; |