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

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

Issue 10542073: RFC: Resolution based tree-shaking. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: All tests pass Created 8 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
Index: dart/lib/compiler/implementation/elements/elements.dart
diff --git a/dart/lib/compiler/implementation/elements/elements.dart b/dart/lib/compiler/implementation/elements/elements.dart
index 7651855f6ffeedc1a4aaa394eed1ce8f2451412f..867c8ce0519283f3c7b7830add00e50bcd79e9bc 100644
--- a/dart/lib/compiler/implementation/elements/elements.dart
+++ b/dart/lib/compiler/implementation/elements/elements.dart
@@ -123,6 +123,7 @@ class Element implements Hashable {
kind === ElementKind.LIBRARY;
}
bool isClass() => kind === ElementKind.CLASS;
+ bool isPrefix() => kind === ElementKind.PREFIX;
bool isVariable() => kind === ElementKind.VARIABLE;
bool isParameter() => kind === ElementKind.PARAMETER;
bool isStatement() => kind === ElementKind.STATEMENT;
@@ -131,9 +132,13 @@ class Element implements Hashable {
bool isField() => kind === ElementKind.FIELD;
bool isGetter() => kind === ElementKind.GETTER;
bool isSetter() => kind === ElementKind.SETTER;
+ bool isAccessor() => isGetter() || isSetter();
+ bool isForeign() => kind === ElementKind.FOREIGN;
bool impliesType() => (kind.category & ElementCategory.IMPLIES_TYPE) != 0;
bool isExtendable() => (kind.category & ElementCategory.IS_EXTENDABLE) != 0;
+ bool isTopLevel() => enclosingElement.isCompilationUnit();
+
bool isAssignable() {
if (modifiers != null && modifiers.isFinal()) return false;
if (isFunction() || isGenerativeConstructor()) return false;
@@ -188,7 +193,23 @@ class Element implements Hashable {
return null;
}
- toString() => '$kind(${name.slowToString()})';
+ Element getOutermostEnclosingMemberOrTopLevel() {
+ for (Element e = this; e !== null; e = e.enclosingElement) {
+ if (e.isMember() || e.isTopLevel()) {
+ return e;
+ }
+ }
+ return null;
+ }
+
+ toString() {
+ if (isMember()) {
ahe 2012/06/12 06:22:49 !isTopLevel()
ahe 2012/06/12 10:56:11 Done.
+ String holderName = enclosingElement.name.slowToString();
+ return '$kind($holderName#${name.slowToString()})';
+ } else {
+ return '$kind(${name.slowToString()})';
+ }
+ }
bool _isNative = false;
void setNative() { _isNative = true; }

Powered by Google App Engine
This is Rietveld 408576698