@@ -240,13 +240,13 @@ abstract class ModelElement implements Comparable {
240
240
241
241
ElementType get modelType => _modelType;
242
242
243
- /// Returns the [ModelElement ] that encloses this.
244
- ModelElement get enclosingElement {
243
+ /// Returns the [ClassElement ] that encloses this.
244
+ Class get enclosingClass {
245
245
// A class's enclosing element is a library, and there isn't a
246
246
// modelelement for a library.
247
247
if (element.enclosingElement != null &&
248
248
element.enclosingElement is ClassElement ) {
249
- return new ModelElement .from (element.enclosingElement, library);
249
+ return new ModelElement .from (element.enclosingElement, library) as Class ;
250
250
} else {
251
251
return null ;
252
252
}
@@ -259,10 +259,13 @@ abstract class ModelElement implements Comparable {
259
259
if (! package.isDocumented (this .element)) {
260
260
return htmlEscape (name);
261
261
}
262
+
262
263
if (name.startsWith ('_' )) {
263
264
return htmlEscape (name);
264
265
}
265
- Class c = enclosingElement;
266
+
267
+ // this smells like it's in the wrong place
268
+ Class c = enclosingClass;
266
269
if (c != null && c.name.startsWith ('_' )) {
267
270
return '${c .name }.${htmlEscape (name )}' ;
268
271
}
@@ -444,7 +447,7 @@ class Package {
444
447
} else {
445
448
el = element;
446
449
}
447
- debugger (when : element.name == 'NAME_SINGLEUNDERSCORE ' );
450
+ // debugger(when: element.name == 'NAME_WITH_TWO_UNDERSCORES ');
448
451
return _libraries.firstWhere ((lib) => lib.hasInNamespace (el),
449
452
orElse: () => null );
450
453
}
@@ -1392,7 +1395,7 @@ class Constructor extends ModelElement {
1392
1395
@override
1393
1396
String get name {
1394
1397
String constructorName = element.name;
1395
- Class c = enclosingElement ;
1398
+ Class c = enclosingClass ;
1396
1399
if (constructorName.isEmpty) {
1397
1400
return c.name;
1398
1401
} else {
0 commit comments