@@ -24,19 +24,20 @@ class Class extends Container
2424 Class (ClassElement element, Library library, PackageGraph packageGraph)
2525 : super (element, library, packageGraph) {
2626 packageGraph.specialClasses.addSpecial (this );
27- mixins = _cls .mixins
27+ mixins = element .mixins
2828 .map ((f) {
2929 DefinedElementType t = ElementType .from (f, library, packageGraph);
3030 return t;
3131 })
3232 .where ((mixin ) => mixin != null )
3333 .toList (growable: false );
3434
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);
3738 }
3839
39- _interfaces = _cls .interfaces
40+ _interfaces = element .interfaces
4041 .map ((f) =>
4142 ElementType .from (f, library, packageGraph) as DefinedElementType )
4243 .toList (growable: false );
@@ -168,7 +169,7 @@ class Class extends Container
168169 List <Constructor > get constructors {
169170 if (_constructors != null ) return _constructors;
170171
171- _constructors = _cls .constructors.map ((e) {
172+ _constructors = element .constructors.map ((e) {
172173 return ModelElement .from (e, library, packageGraph) as Constructor ;
173174 }).toList (growable: true )
174175 ..sort (byName);
@@ -183,6 +184,9 @@ class Class extends Container
183184 @override
184185 ModelElement get enclosingElement => library;
185186
187+ @override
188+ ClassElement get element => super .element;
189+
186190 @override
187191 String get fileName => '$name -class.$fileType ' ;
188192
@@ -319,7 +323,7 @@ class Class extends Container
319323 Iterable <DefinedElementType > get publicInterfaces =>
320324 model_utils.filterNonPublic (interfaces);
321325
322- bool get isAbstract => _cls .isAbstract;
326+ bool get isAbstract => element .isAbstract;
323327
324328 @override
325329 bool get isCanonical => super .isCanonical && isPublic;
@@ -331,9 +335,9 @@ class Class extends Container
331335 }
332336
333337 // if this class is itself Error or Exception, return true
334- if (_doCheck (_cls )) return true ;
338+ if (_doCheck (element )) return true ;
335339
336- return _cls .allSupertypes.map ((t) => t.element).any (_doCheck);
340+ return element .allSupertypes.map ((t) => t.element).any (_doCheck);
337341 }
338342
339343 /// Returns true if [other] is a parent class for this class.
@@ -410,13 +414,12 @@ class Class extends Container
410414
411415 List <ExecutableElement > get _inheritedElements {
412416 if (__inheritedElements == null ) {
413- var classElement = element as ClassElement ;
414- if (classElement.isDartCoreObject) {
417+ if (element.isDartCoreObject) {
415418 return __inheritedElements = < ExecutableElement > [];
416419 }
417420
418421 var inheritance = definingLibrary.inheritanceManager;
419- var classType = classElement .thisType;
422+ var classType = element .thisType;
420423 var cmap = inheritance.getInheritedConcreteMap (classType);
421424 var imap = inheritance.getInheritedMap (classType);
422425
@@ -454,7 +457,7 @@ class Class extends Container
454457 // For half-inherited fields, the analyzer only links the non-inherited
455458 // to the [FieldElement]. Compose our [Field] class by hand by looking up
456459 // inherited accessors that may be related.
457- for (FieldElement f in _cls .fields) {
460+ for (FieldElement f in element .fields) {
458461 PropertyAccessorElement getterElement = f.getter;
459462 if (getterElement == null && accessorMap.containsKey (f.name)) {
460463 getterElement = accessorMap[f.name]
@@ -543,14 +546,12 @@ class Class extends Container
543546 _fields.add (field);
544547 }
545548
546- ClassElement get _cls => (element as ClassElement );
547-
548549 List <Method > _methods;
549550
550551 @override
551552 List <Method > get methods {
552553 if (_methods == null ) {
553- _methods = _cls .methods.map ((e) {
554+ _methods = element .methods.map ((e) {
554555 return ModelElement .from (e, library, packageGraph) as Method ;
555556 }).toList (growable: false )
556557 ..sort (byName);
@@ -564,7 +565,7 @@ class Class extends Container
564565 @override
565566 List <TypeParameter > get typeParameters {
566567 if (_typeParameters == null ) {
567- _typeParameters = _cls .typeParameters.map ((f) {
568+ _typeParameters = element .typeParameters.map ((f) {
568569 var lib = Library (f.enclosingElement.library, packageGraph);
569570 return ModelElement .from (f, lib, packageGraph) as TypeParameter ;
570571 }).toList ();
0 commit comments