@@ -24,19 +24,20 @@ class Class extends Container
24
24
Class (ClassElement element, Library library, PackageGraph packageGraph)
25
25
: super (element, library, packageGraph) {
26
26
packageGraph.specialClasses.addSpecial (this );
27
- mixins = _cls .mixins
27
+ mixins = element .mixins
28
28
.map ((f) {
29
29
DefinedElementType t = ElementType .from (f, library, packageGraph);
30
30
return t;
31
31
})
32
32
.where ((mixin ) => mixin != null )
33
33
.toList (growable: false );
34
34
35
- if (_cls.supertype != null && _cls.supertype.element.supertype != null ) {
36
- supertype = ElementType .from (_cls.supertype, library, packageGraph);
35
+ if (element.supertype != null &&
36
+ element.supertype.element.supertype != null ) {
37
+ supertype = ElementType .from (element.supertype, library, packageGraph);
37
38
}
38
39
39
- _interfaces = _cls .interfaces
40
+ _interfaces = element .interfaces
40
41
.map ((f) =>
41
42
ElementType .from (f, library, packageGraph) as DefinedElementType )
42
43
.toList (growable: false );
@@ -168,7 +169,7 @@ class Class extends Container
168
169
List <Constructor > get constructors {
169
170
if (_constructors != null ) return _constructors;
170
171
171
- _constructors = _cls .constructors.map ((e) {
172
+ _constructors = element .constructors.map ((e) {
172
173
return ModelElement .from (e, library, packageGraph) as Constructor ;
173
174
}).toList (growable: true )
174
175
..sort (byName);
@@ -183,6 +184,9 @@ class Class extends Container
183
184
@override
184
185
ModelElement get enclosingElement => library;
185
186
187
+ @override
188
+ ClassElement get element => super .element;
189
+
186
190
@override
187
191
String get fileName => '$name -class.$fileType ' ;
188
192
@@ -319,7 +323,7 @@ class Class extends Container
319
323
Iterable <DefinedElementType > get publicInterfaces =>
320
324
model_utils.filterNonPublic (interfaces);
321
325
322
- bool get isAbstract => _cls .isAbstract;
326
+ bool get isAbstract => element .isAbstract;
323
327
324
328
@override
325
329
bool get isCanonical => super .isCanonical && isPublic;
@@ -331,9 +335,9 @@ class Class extends Container
331
335
}
332
336
333
337
// if this class is itself Error or Exception, return true
334
- if (_doCheck (_cls )) return true ;
338
+ if (_doCheck (element )) return true ;
335
339
336
- return _cls .allSupertypes.map ((t) => t.element).any (_doCheck);
340
+ return element .allSupertypes.map ((t) => t.element).any (_doCheck);
337
341
}
338
342
339
343
/// Returns true if [other] is a parent class for this class.
@@ -410,13 +414,12 @@ class Class extends Container
410
414
411
415
List <ExecutableElement > get _inheritedElements {
412
416
if (__inheritedElements == null ) {
413
- var classElement = element as ClassElement ;
414
- if (classElement.isDartCoreObject) {
417
+ if (element.isDartCoreObject) {
415
418
return __inheritedElements = < ExecutableElement > [];
416
419
}
417
420
418
421
var inheritance = definingLibrary.inheritanceManager;
419
- var classType = classElement .thisType;
422
+ var classType = element .thisType;
420
423
var cmap = inheritance.getInheritedConcreteMap (classType);
421
424
var imap = inheritance.getInheritedMap (classType);
422
425
@@ -454,7 +457,7 @@ class Class extends Container
454
457
// For half-inherited fields, the analyzer only links the non-inherited
455
458
// to the [FieldElement]. Compose our [Field] class by hand by looking up
456
459
// inherited accessors that may be related.
457
- for (FieldElement f in _cls .fields) {
460
+ for (FieldElement f in element .fields) {
458
461
PropertyAccessorElement getterElement = f.getter;
459
462
if (getterElement == null && accessorMap.containsKey (f.name)) {
460
463
getterElement = accessorMap[f.name]
@@ -543,14 +546,12 @@ class Class extends Container
543
546
_fields.add (field);
544
547
}
545
548
546
- ClassElement get _cls => (element as ClassElement );
547
-
548
549
List <Method > _methods;
549
550
550
551
@override
551
552
List <Method > get methods {
552
553
if (_methods == null ) {
553
- _methods = _cls .methods.map ((e) {
554
+ _methods = element .methods.map ((e) {
554
555
return ModelElement .from (e, library, packageGraph) as Method ;
555
556
}).toList (growable: false )
556
557
..sort (byName);
@@ -564,7 +565,7 @@ class Class extends Container
564
565
@override
565
566
List <TypeParameter > get typeParameters {
566
567
if (_typeParameters == null ) {
567
- _typeParameters = _cls .typeParameters.map ((f) {
568
+ _typeParameters = element .typeParameters.map ((f) {
568
569
var lib = Library (f.enclosingElement.library, packageGraph);
569
570
return ModelElement .from (f, lib, packageGraph) as TypeParameter ;
570
571
}).toList ();
0 commit comments