@@ -269,20 +269,29 @@ class Accessor extends ModelElement
269
269
}
270
270
271
271
GetterSetterCombo get enclosingCombo {
272
- if (_enclosingCombo == null ) if (enclosingElement is Class ) {
273
- // TODO(jcollins-g): this side effect is rather hacky. Make sure
274
- // enclosingCombo always gets set at accessor creation time, somehow, to
275
- // avoid this.
276
- // TODO(jcollins-g): This also doesn't work for private accessors sometimes.
277
- (enclosingElement as Class ).allInstanceProperties;
278
- }
279
- assert (_enclosingCombo != null );
272
+ if (_enclosingCombo == null ) {
273
+ if (enclosingElement is Class ) {
274
+ // TODO(jcollins-g): this side effect is rather hacky. Make sure
275
+ // enclosingCombo always gets set at accessor creation time, somehow, to
276
+ // avoid this.
277
+ // TODO(jcollins-g): This also doesn't work for private accessors sometimes.
278
+ (enclosingElement as Class ).allFields;
279
+ }
280
+ /*
281
+ if (_enclosingCombo == null && isSynthetic) {
282
+ // Synthetic accessors sometimes don't have enclosing combos. Pretend
283
+ // for hyperlinks.
284
+ 1+1;
285
+ }*/
286
+ assert (_enclosingCombo != null );
287
+ }
280
288
return _enclosingCombo;
281
289
}
282
290
283
291
/// Call exactly once to set the enclosing combo for this Accessor.
284
- void set enclosingCombo (GetterSetterCombo combo) {
292
+ set enclosingCombo (GetterSetterCombo combo) {
285
293
assert (_enclosingCombo == null || combo == _enclosingCombo);
294
+ assert (combo != null );
286
295
_enclosingCombo = combo;
287
296
}
288
297
@@ -310,10 +319,7 @@ class Accessor extends ModelElement
310
319
@override
311
320
String get computeDocumentationComment {
312
321
if (isSynthetic) {
313
- String docComment = new ModelElement .fromElement (
314
- (element as PropertyAccessorElement ).variable, package)
315
- .element
316
- .documentationComment;
322
+ String docComment = (element as PropertyAccessorElement ).variable.documentationComment;
317
323
// If we're a setter, only display something if we have something different than the getter.
318
324
// TODO(jcollins-g): modify analyzer to do this itself?
319
325
if (isGetter ||
@@ -534,7 +540,7 @@ class Class extends ModelElement
534
540
535
541
List <Field > get constants {
536
542
if (_constants != null ) return _constants;
537
- _constants = _allFields .where ((f) => f.isConst).toList (growable: false )
543
+ _constants = allFields .where ((f) => f.isConst).toList (growable: false )
538
544
..sort (byName);
539
545
540
546
return _constants;
@@ -802,7 +808,7 @@ class Class extends ModelElement
802
808
803
809
List <Field > get inheritedProperties {
804
810
if (_inheritedProperties == null ) {
805
- _inheritedProperties = _allFields .where ((f) => f.isInherited).toList ()
811
+ _inheritedProperties = allFields .where ((f) => f.isInherited).toList ()
806
812
..sort (byName);
807
813
}
808
814
return _inheritedProperties;
@@ -827,7 +833,7 @@ class Class extends ModelElement
827
833
828
834
List <Field > get instanceProperties {
829
835
if (_instanceFields != null ) return _instanceFields;
830
- _instanceFields = _allFields
836
+ _instanceFields = allFields
831
837
.where ((f) => ! f.isStatic && ! f.isInherited && ! f.isConst)
832
838
.toList (growable: false )
833
839
..sort (byName);
@@ -924,7 +930,7 @@ class Class extends ModelElement
924
930
925
931
List <Field > get staticProperties {
926
932
if (_staticFields != null ) return _staticFields;
927
- _staticFields = _allFields
933
+ _staticFields = allFields
928
934
.where ((f) => f.isStatic)
929
935
.where ((f) => ! f.isConst)
930
936
.toList (growable: false )
@@ -981,7 +987,7 @@ class Class extends ModelElement
981
987
982
988
ElementType get supertype => _supertype;
983
989
984
- List <Field > get _allFields {
990
+ List <Field > get allFields {
985
991
if (_fields != null ) return _fields;
986
992
_fields = [];
987
993
Map <String , ExecutableElement > cmap =
@@ -1090,6 +1096,8 @@ class Class extends ModelElement
1090
1096
// TODO(jcollins-g): Navigation is probably still confusing for
1091
1097
// half-inherited fields when traversing the inheritance tree. Make
1092
1098
// this better, somehow.
1099
+ if (f.name == 'target' && name == 'HitTestEntry' )
1100
+ 1 + 1 ;
1093
1101
field = new ModelElement .from (f, library, getter: getter, setter: setter);
1094
1102
}
1095
1103
_fields.add (field);
@@ -2610,6 +2618,8 @@ abstract class ModelElement extends Canonicalization
2610
2618
} else if (e.enclosingElement.isEnum) {
2611
2619
newModelElement = new EnumField (e, library, getter, setter);
2612
2620
} else {
2621
+ if (e.name == 'target' && e.enclosingElement.name == 'HitTestEntry' && library.name == 'hit_test' )
2622
+ 1 + 1 ;
2613
2623
newModelElement = new Field (e, library, getter, setter);
2614
2624
}
2615
2625
} else {
@@ -2642,6 +2652,8 @@ abstract class ModelElement extends Canonicalization
2642
2652
..addAll (library.constants);
2643
2653
newModelElement = allVariables.firstWhere ((v) => v.element == e);
2644
2654
} else {
2655
+ if (e.name == 'kAlwaysDismissedAnimation' )
2656
+ 1 + 1 ;
2645
2657
newModelElement = new TopLevelVariable (e, library, getter, setter);
2646
2658
}
2647
2659
}
@@ -2683,10 +2695,7 @@ abstract class ModelElement extends Canonicalization
2683
2695
}
2684
2696
}
2685
2697
if (newModelElement is GetterSetterCombo ) {
2686
- if (getter != null ) {
2687
- assert (
2688
- getter == null || newModelElement? .getter? .enclosingCombo != null );
2689
- }
2698
+ assert (getter == null || newModelElement? .getter? .enclosingCombo != null );
2690
2699
assert (setter == null || newModelElement? .setter? .enclosingCombo != null );
2691
2700
}
2692
2701
@@ -4726,8 +4735,14 @@ class TopLevelVariable extends ModelElement
4726
4735
TopLevelVariable (TopLevelVariableElement element, Library library,
4727
4736
this .getter, this .setter)
4728
4737
: super (element, library, null ) {
4729
- if (getter != null ) getter.enclosingCombo = this ;
4730
- if (setter != null ) setter.enclosingCombo = this ;
4738
+ if (getter != null ) {
4739
+ getter.enclosingCombo = this ;
4740
+ assert (getter.enclosingCombo != null );
4741
+ }
4742
+ if (setter != null ) {
4743
+ setter.enclosingCombo = this ;
4744
+ assert (setter.enclosingCombo != null );
4745
+ }
4731
4746
}
4732
4747
4733
4748
@override
0 commit comments