@@ -292,8 +292,8 @@ abstract class ModelElement implements Comparable {
292
292
buf.write (' <span class="parameter-name">${p .name }</span>' );
293
293
}
294
294
buf.write ('(' );
295
- buf.write (p.modelType.element. linkedParams (
296
- showNames: showNames, showMetadata: showMetadata));
295
+ buf.write (p.modelType.element
296
+ . linkedParams ( showNames: showNames, showMetadata: showMetadata));
297
297
buf.write (')' );
298
298
} else if (p.modelType != null && p.modelType.element != null ) {
299
299
var mt = p.modelType;
@@ -553,7 +553,10 @@ class Library extends ModelElement {
553
553
elements..removeWhere (isPrivate);
554
554
_variables = elements
555
555
.map ((e) => new TopLevelVariable (e, this ))
556
- .toList (growable: false )..sort (byName);
556
+ .toList (growable: false );
557
+
558
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
559
+ if (_variables.isNotEmpty) _variables.sort (byName);
557
560
558
561
return _variables;
559
562
}
@@ -562,15 +565,22 @@ class Library extends ModelElement {
562
565
563
566
/// All variables ("properties") except constants.
564
567
List <TopLevelVariable > get properties {
565
- return _getVariables ().where ((v) => ! v.isConst).toList (growable: false )
566
- ..sort (byName);
568
+ List temp =
569
+ _getVariables ().where ((v) => ! v.isConst).toList (growable: false );
570
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
571
+ if (temp.isNotEmpty) temp.sort (byName);
572
+ return temp;
567
573
}
568
574
569
575
bool get hasConstants => _getVariables ().any ((v) => v.isConst);
570
576
571
577
List <TopLevelVariable > get constants {
572
- return _getVariables ().where ((v) => v.isConst).toList (growable: false )
573
- ..sort (byName);
578
+ List temp = _getVariables ().where ((v) => v.isConst).toList (growable: false );
579
+
580
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
581
+ if (temp.isNotEmpty) temp.sort (byName);
582
+
583
+ return temp;
574
584
}
575
585
576
586
bool get hasEnums => enums.isNotEmpty;
@@ -584,7 +594,11 @@ class Library extends ModelElement {
584
594
_enums = enumClasses
585
595
.where (isPublic)
586
596
.map ((e) => new Enum (e, this ))
587
- .toList (growable: false )..sort ((a, b) => a.name.compareTo (b.name));
597
+ .toList (growable: false );
598
+
599
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
600
+ if (_enums.isNotEmpty) _enums.sort (byName);
601
+
588
602
return _enums;
589
603
}
590
604
@@ -606,9 +620,12 @@ class Library extends ModelElement {
606
620
elements.addAll (_exportedNamespace
607
621
.where ((element) => element is FunctionTypeAliasElement ));
608
622
elements..removeWhere (isPrivate);
609
- _typeDefs = elements
610
- .map ((e) => new Typedef (e, this ))
611
- .toList (growable: false )..sort (byName);
623
+ _typeDefs =
624
+ elements.map ((e) => new Typedef (e, this )).toList (growable: false );
625
+
626
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
627
+ if (_typeDefs.isNotEmpty) _typeDefs.sort (byName);
628
+
612
629
return _typeDefs;
613
630
}
614
631
@@ -628,7 +645,11 @@ class Library extends ModelElement {
628
645
elements..removeWhere (isPrivate);
629
646
_functions = elements.map ((e) {
630
647
return new ModelFunction (e, this );
631
- }).toList (growable: false )..sort (byName);
648
+ }).toList (growable: false );
649
+
650
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
651
+ if (_functions.isNotEmpty) _functions.sort (byName);
652
+
632
653
return _functions;
633
654
}
634
655
@@ -652,14 +673,18 @@ class Library extends ModelElement {
652
673
_classes = types
653
674
.where (isPublic)
654
675
.map ((e) => new Class (e, this ))
655
- .toList (growable: false )..sort (byName);
676
+ .toList (growable: false );
677
+
678
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
679
+ if (_classes.isNotEmpty) _classes.sort (byName);
656
680
657
681
return _classes;
658
682
}
659
683
660
684
List <Class > get classes {
661
- return _allClasses.where ((c) => ! c.isErrorOrException).toList (
662
- growable: false );
685
+ return _allClasses
686
+ .where ((c) => ! c.isErrorOrException)
687
+ .toList (growable: false );
663
688
}
664
689
665
690
List <Class > get allClasses => _allClasses;
@@ -669,8 +694,13 @@ class Library extends ModelElement {
669
694
bool get hasExceptions => _allClasses.any ((c) => c.isErrorOrException);
670
695
671
696
List <Class > get exceptions {
672
- return _allClasses.where ((c) => c.isErrorOrException).toList (
673
- growable: false )..sort (byName);
697
+ List temp =
698
+ _allClasses.where ((c) => c.isErrorOrException).toList (growable: false );
699
+
700
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
701
+ if (temp.isNotEmpty) temp.sort (byName);
702
+
703
+ return temp;
674
704
}
675
705
676
706
@override
@@ -751,9 +781,9 @@ class Class extends ModelElement {
751
781
}
752
782
753
783
List <TypeParameter > get _typeParameters => _cls.typeParameters.map ((f) {
754
- var lib = new Library (f.enclosingElement.library, package);
755
- return new TypeParameter (f, lib);
756
- }).toList ();
784
+ var lib = new Library (f.enclosingElement.library, package);
785
+ return new TypeParameter (f, lib);
786
+ }).toList ();
757
787
758
788
String get kind => 'class' ;
759
789
@@ -803,7 +833,10 @@ class Class extends ModelElement {
803
833
_fields = _cls.fields
804
834
.where (isPublic)
805
835
.map ((e) => new Field (e, library))
806
- .toList (growable: false )..sort (byName);
836
+ .toList (growable: false );
837
+
838
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
839
+ if (_fields.isNotEmpty) _fields.sort (byName);
807
840
808
841
return _fields;
809
842
}
@@ -813,25 +846,34 @@ class Class extends ModelElement {
813
846
_staticFields = _allFields
814
847
.where ((f) => f.isStatic)
815
848
.where ((f) => ! f.isConst)
816
- .toList (growable: false )..sort (byName);
849
+ .toList (growable: false );
850
+
851
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
852
+ if (_staticFields.isNotEmpty) _staticFields.sort (byName);
853
+
817
854
return _staticFields;
818
855
}
819
856
820
857
bool get hasInstanceProperties => instanceProperties.isNotEmpty;
821
858
822
859
List <Field > get instanceProperties {
823
860
if (_instanceFields != null ) return _instanceFields;
824
- _instanceFields = _allFields
825
- .where ((f) => ! f.isStatic)
826
- .toList (growable: false )..sort (byName);
861
+ _instanceFields =
862
+ _allFields.where ((f) => ! f.isStatic).toList (growable: false );
863
+
864
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
865
+ if (_instanceFields.isNotEmpty) _instanceFields.sort (byName);
827
866
828
867
return _instanceFields;
829
868
}
830
869
831
870
List <Field > get constants {
832
871
if (_constants != null ) return _constants;
833
- _constants = _allFields.where ((f) => f.isConst).toList (growable: false )
834
- ..sort ((a, b) => a.name.compareTo (b.name));
872
+ _constants = _allFields.where ((f) => f.isConst).toList (growable: false );
873
+
874
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
875
+ if (_constants.isNotEmpty) _constants.sort (byName);
876
+
835
877
return _constants;
836
878
}
837
879
@@ -844,7 +886,10 @@ class Class extends ModelElement {
844
886
845
887
_constructors = _cls.constructors.where (isPublic).map ((e) {
846
888
return new Constructor (e, library);
847
- }).toList (growable: true )..sort (byName);
889
+ }).toList (growable: true );
890
+
891
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
892
+ if (_constructors.isNotEmpty) _constructors.sort (byName);
848
893
849
894
return _constructors;
850
895
}
@@ -860,16 +905,21 @@ class Class extends ModelElement {
860
905
} else {
861
906
return new Operator (e, library);
862
907
}
863
- }).toList (growable: false )..sort (byName);
908
+ }).toList (growable: false );
909
+
910
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
911
+ if (_allMethods.isNotEmpty) _allMethods.sort (byName);
864
912
865
913
return _allMethods;
866
914
}
867
915
868
916
List <Operator > get operators {
869
917
if (_operators != null ) return _operators;
870
918
871
- _operators = _methods.where ((m) => m.isOperator).toList (growable: false )
872
- ..sort (byName);
919
+ _operators = _methods.where ((m) => m.isOperator).toList (growable: false );
920
+
921
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
922
+ if (_operators.isNotEmpty) _operators.sort (byName);
873
923
874
924
return _operators;
875
925
}
@@ -889,8 +939,10 @@ class Class extends ModelElement {
889
939
List <Method > get staticMethods {
890
940
if (_staticMethods != null ) return _staticMethods;
891
941
892
- _staticMethods = _methods.where ((m) => m.isStatic).toList (growable: false )
893
- ..sort (byName);
942
+ _staticMethods = _methods.where ((m) => m.isStatic).toList (growable: false );
943
+
944
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
945
+ if (_staticMethods.isNotEmpty) _staticMethods.sort (byName);
894
946
895
947
return _staticMethods;
896
948
}
@@ -902,7 +954,10 @@ class Class extends ModelElement {
902
954
903
955
_instanceMethods = _methods
904
956
.where ((m) => ! m.isStatic && ! m.isOperator)
905
- .toList (growable: false )..sort (byName);
957
+ .toList (growable: false );
958
+
959
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
960
+ if (_instanceMethods.isNotEmpty) _instanceMethods.sort (byName);
906
961
907
962
return _instanceMethods;
908
963
}
@@ -962,7 +1017,7 @@ class Class extends ModelElement {
962
1017
}
963
1018
}
964
1019
965
- _inheritedMethods.. sort (byName);
1020
+ _inheritedMethods.sort (byName);
966
1021
967
1022
return _inheritedMethods;
968
1023
}
@@ -1021,7 +1076,7 @@ class Class extends ModelElement {
1021
1076
_inheritedOperators.add (new Operator .inherited (value, lib));
1022
1077
}
1023
1078
1024
- _inheritedOperators.. sort (byName);
1079
+ _inheritedOperators.sort (byName);
1025
1080
1026
1081
return _inheritedOperators;
1027
1082
}
@@ -1080,7 +1135,7 @@ class Class extends ModelElement {
1080
1135
}
1081
1136
}
1082
1137
1083
- _inheritedProperties.. sort (byName);
1138
+ _inheritedProperties.sort (byName);
1084
1139
1085
1140
return _inheritedProperties;
1086
1141
}
@@ -1147,14 +1202,18 @@ class Enum extends Class {
1147
1202
.where (isPublic)
1148
1203
.where ((f) => f.isConst)
1149
1204
.map ((field) => new EnumField .forConstant (index++ , field, library))
1150
- .toList (growable: false )..sort (byName);
1205
+ .toList (growable: false );
1206
+
1207
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
1208
+ if (_constants.isNotEmpty) _constants.sort (byName);
1151
1209
1152
1210
return _constants;
1153
1211
}
1154
1212
1155
1213
@override
1156
1214
List <EnumField > get instanceProperties {
1157
- return super .instanceProperties
1215
+ return super
1216
+ .instanceProperties
1158
1217
.map ((Field p) => new EnumField (p.element, p.library))
1159
1218
.toList (growable: false );
1160
1219
}
@@ -1647,8 +1706,10 @@ class ElementType {
1647
1706
1648
1707
ElementType get _returnType {
1649
1708
var rt = (_type as FunctionType ).returnType;
1650
- return new ElementType (rt, new ModelElement .from (
1651
- rt.element, new Library (_element.library.element, _element.package)));
1709
+ return new ElementType (
1710
+ rt,
1711
+ new ModelElement .from (rt.element,
1712
+ new Library (_element.library.element, _element.package)));
1652
1713
}
1653
1714
1654
1715
ModelElement get returnElement {
@@ -1662,9 +1723,9 @@ class ElementType {
1662
1723
1663
1724
List <ElementType > get typeArguments =>
1664
1725
(_type as ParameterizedType ).typeArguments.map ((f) {
1665
- var lib = new Library (f.element.library, _element.package);
1666
- return new ElementType (f, new ModelElement .from (f.element, lib));
1667
- }).toList ();
1726
+ var lib = new Library (f.element.library, _element.package);
1727
+ return new ElementType (f, new ModelElement .from (f.element, lib));
1728
+ }).toList ();
1668
1729
1669
1730
String get linkedName {
1670
1731
if (_linkedName != null ) return _linkedName;
0 commit comments