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

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

Issue 10834243: Reduce usage of .enclosingElement to get enclosing class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/namer.dart
diff --git a/lib/compiler/implementation/namer.dart b/lib/compiler/implementation/namer.dart
index c30a2784a7ebcbfc9b73064d258398dfdb5311fc..f9a21c82906bfdef084dbac10048590fe3b4b089 100644
--- a/lib/compiler/implementation/namer.dart
+++ b/lib/compiler/implementation/namer.dart
@@ -178,16 +178,16 @@ class Namer {
LibraryElement lib = element.getLibrary();
String name;
if (element.isGenerativeConstructor()) {
- if (element.name == element.enclosingElement.name) {
+ if (element.name == element.getEnclosingClass().name) {
// Keep the class name for the class and not the factory.
name = "${element.name.slowToString()}\$";
} else {
name = element.name.slowToString();
}
} else if (Elements.isStaticOrTopLevel(element)) {
- if (element.enclosingElement != null &&
- element.enclosingElement.isClass()) {
- name = "${element.enclosingElement.name.slowToString()}_"
+ if (element.isMember()) {
+ ClassElement enclosingClass = element.getEnclosingClass();
+ name = "${enclosingClass.name.slowToString()}_"
"${element.name.slowToString()}";
} else {
name = element.name.slowToString();

Powered by Google App Engine
This is Rietveld 408576698