| Index: lib/compiler/implementation/elements/elements.dart
|
| diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
|
| index ad690789f5fbb8c414a1ab6995d0c5cfe0b77fdc..923c858d400feee9a9ec2fd53f1ab2ffeb179b6e 100644
|
| --- a/lib/compiler/implementation/elements/elements.dart
|
| +++ b/lib/compiler/implementation/elements/elements.dart
|
| @@ -139,6 +139,10 @@ class Element implements Hashable {
|
| bool impliesType() => (kind.category & ElementCategory.IMPLIES_TYPE) != 0;
|
| bool isExtendable() => (kind.category & ElementCategory.IS_EXTENDABLE) != 0;
|
|
|
| + // TODO(johnniwinther): This breaks for libraries (for which enclosing
|
| + // elements are null) and is invalid for top level variable declarations for
|
| + // which the enclosing element is a VariableDeclarations and not a compilation
|
| + // unit.
|
| bool isTopLevel() => enclosingElement.isCompilationUnit();
|
|
|
| bool isAssignable() {
|
| @@ -207,7 +211,7 @@ class Element implements Hashable {
|
| String toString() {
|
| // TODO(johnniwinther): Test for nullness of name, or make non-nullness an
|
| // invariant for all element types.
|
| - if (!isTopLevel()) {
|
| + if (enclosingElement !== null && !isTopLevel()) {
|
| String holderName = enclosingElement.name.slowToString();
|
| return '$kind($holderName#${name.slowToString()})';
|
| } else {
|
|
|