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

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10913133: Allow closures inside lazy initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. Created 8 years, 2 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
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;

Powered by Google App Engine
This is Rietveld 408576698