@@ -296,8 +296,8 @@ abstract class ModelElement implements Comparable {
296
296
buf.write (' <span class="parameter-name">${p .name }</span>' );
297
297
}
298
298
buf.write ('(' );
299
- buf.write (p.modelType.element. linkedParams (
300
- showNames: showNames, showMetadata: showMetadata));
299
+ buf.write (p.modelType.element
300
+ . linkedParams ( showNames: showNames, showMetadata: showMetadata));
301
301
buf.write (')' );
302
302
} else if (p.modelType != null && p.modelType.element != null ) {
303
303
var mt = p.modelType;
@@ -570,7 +570,10 @@ class Library extends ModelElement {
570
570
elements..removeWhere (isPrivate);
571
571
_variables = elements
572
572
.map ((e) => new TopLevelVariable (e, this ))
573
- .toList (growable: false )..sort (byName);
573
+ .toList (growable: false );
574
+
575
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
576
+ if (_variables.isNotEmpty) _variables.sort (byName);
574
577
575
578
return _variables;
576
579
}
@@ -579,15 +582,22 @@ class Library extends ModelElement {
579
582
580
583
/// All variables ("properties") except constants.
581
584
List <TopLevelVariable > get properties {
582
- return _getVariables ().where ((v) => ! v.isConst).toList (growable: false )
583
- ..sort (byName);
585
+ List temp =
586
+ _getVariables ().where ((v) => ! v.isConst).toList (growable: false );
587
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
588
+ if (temp.isNotEmpty) temp.sort (byName);
589
+ return temp;
584
590
}
585
591
586
592
bool get hasConstants => _getVariables ().any ((v) => v.isConst);
587
593
588
594
List <TopLevelVariable > get constants {
589
- return _getVariables ().where ((v) => v.isConst).toList (growable: false )
590
- ..sort (byName);
595
+ List temp = _getVariables ().where ((v) => v.isConst).toList (growable: false );
596
+
597
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
598
+ if (temp.isNotEmpty) temp.sort (byName);
599
+
600
+ return temp;
591
601
}
592
602
593
603
bool get hasEnums => enums.isNotEmpty;
@@ -601,7 +611,11 @@ class Library extends ModelElement {
601
611
_enums = enumClasses
602
612
.where (isPublic)
603
613
.map ((e) => new Enum (e, this ))
604
- .toList (growable: false )..sort ((a, b) => a.name.compareTo (b.name));
614
+ .toList (growable: false );
615
+
616
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
617
+ if (_enums.isNotEmpty) _enums.sort (byName);
618
+
605
619
return _enums;
606
620
}
607
621
@@ -623,9 +637,12 @@ class Library extends ModelElement {
623
637
elements.addAll (_exportedNamespace
624
638
.where ((element) => element is FunctionTypeAliasElement ));
625
639
elements..removeWhere (isPrivate);
626
- _typeDefs = elements
627
- .map ((e) => new Typedef (e, this ))
628
- .toList (growable: false )..sort (byName);
640
+ _typeDefs =
641
+ elements.map ((e) => new Typedef (e, this )).toList (growable: false );
642
+
643
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
644
+ if (_typeDefs.isNotEmpty) _typeDefs.sort (byName);
645
+
629
646
return _typeDefs;
630
647
}
631
648
@@ -645,7 +662,11 @@ class Library extends ModelElement {
645
662
elements..removeWhere (isPrivate);
646
663
_functions = elements.map ((e) {
647
664
return new ModelFunction (e, this );
648
- }).toList (growable: false )..sort (byName);
665
+ }).toList (growable: false );
666
+
667
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
668
+ if (_functions.isNotEmpty) _functions.sort (byName);
669
+
649
670
return _functions;
650
671
}
651
672
@@ -669,14 +690,18 @@ class Library extends ModelElement {
669
690
_classes = types
670
691
.where (isPublic)
671
692
.map ((e) => new Class (e, this ))
672
- .toList (growable: false )..sort (byName);
693
+ .toList (growable: false );
694
+
695
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
696
+ if (_classes.isNotEmpty) _classes.sort (byName);
673
697
674
698
return _classes;
675
699
}
676
700
677
701
List <Class > get classes {
678
- return _allClasses.where ((c) => ! c.isErrorOrException).toList (
679
- growable: false );
702
+ return _allClasses
703
+ .where ((c) => ! c.isErrorOrException)
704
+ .toList (growable: false );
680
705
}
681
706
682
707
List <Class > get allClasses => _allClasses;
@@ -686,8 +711,13 @@ class Library extends ModelElement {
686
711
bool get hasExceptions => _allClasses.any ((c) => c.isErrorOrException);
687
712
688
713
List <Class > get exceptions {
689
- return _allClasses.where ((c) => c.isErrorOrException).toList (
690
- growable: false )..sort (byName);
714
+ List temp =
715
+ _allClasses.where ((c) => c.isErrorOrException).toList (growable: false );
716
+
717
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
718
+ if (temp.isNotEmpty) temp.sort (byName);
719
+
720
+ return temp;
691
721
}
692
722
693
723
@override
@@ -768,9 +798,9 @@ class Class extends ModelElement {
768
798
}
769
799
770
800
List <TypeParameter > get _typeParameters => _cls.typeParameters.map ((f) {
771
- var lib = new Library (f.enclosingElement.library, package);
772
- return new TypeParameter (f, lib);
773
- }).toList ();
801
+ var lib = new Library (f.enclosingElement.library, package);
802
+ return new TypeParameter (f, lib);
803
+ }).toList ();
774
804
775
805
String get kind => 'class' ;
776
806
@@ -820,7 +850,10 @@ class Class extends ModelElement {
820
850
_fields = _cls.fields
821
851
.where (isPublic)
822
852
.map ((e) => new Field (e, library))
823
- .toList (growable: false )..sort (byName);
853
+ .toList (growable: false );
854
+
855
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
856
+ if (_fields.isNotEmpty) _fields.sort (byName);
824
857
825
858
return _fields;
826
859
}
@@ -830,25 +863,34 @@ class Class extends ModelElement {
830
863
_staticFields = _allFields
831
864
.where ((f) => f.isStatic)
832
865
.where ((f) => ! f.isConst)
833
- .toList (growable: false )..sort (byName);
866
+ .toList (growable: false );
867
+
868
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
869
+ if (_staticFields.isNotEmpty) _staticFields.sort (byName);
870
+
834
871
return _staticFields;
835
872
}
836
873
837
874
bool get hasInstanceProperties => instanceProperties.isNotEmpty;
838
875
839
876
List <Field > get instanceProperties {
840
877
if (_instanceFields != null ) return _instanceFields;
841
- _instanceFields = _allFields
842
- .where ((f) => ! f.isStatic)
843
- .toList (growable: false )..sort (byName);
878
+ _instanceFields =
879
+ _allFields.where ((f) => ! f.isStatic).toList (growable: false );
880
+
881
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
882
+ if (_instanceFields.isNotEmpty) _instanceFields.sort (byName);
844
883
845
884
return _instanceFields;
846
885
}
847
886
848
887
List <Field > get constants {
849
888
if (_constants != null ) return _constants;
850
- _constants = _allFields.where ((f) => f.isConst).toList (growable: false )
851
- ..sort ((a, b) => a.name.compareTo (b.name));
889
+ _constants = _allFields.where ((f) => f.isConst).toList (growable: false );
890
+
891
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
892
+ if (_constants.isNotEmpty) _constants.sort (byName);
893
+
852
894
return _constants;
853
895
}
854
896
@@ -861,7 +903,10 @@ class Class extends ModelElement {
861
903
862
904
_constructors = _cls.constructors.where (isPublic).map ((e) {
863
905
return new Constructor (e, library);
864
- }).toList (growable: true )..sort (byName);
906
+ }).toList (growable: true );
907
+
908
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
909
+ if (_constructors.isNotEmpty) _constructors.sort (byName);
865
910
866
911
return _constructors;
867
912
}
@@ -877,16 +922,21 @@ class Class extends ModelElement {
877
922
} else {
878
923
return new Operator (e, library);
879
924
}
880
- }).toList (growable: false )..sort (byName);
925
+ }).toList (growable: false );
926
+
927
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
928
+ if (_allMethods.isNotEmpty) _allMethods.sort (byName);
881
929
882
930
return _allMethods;
883
931
}
884
932
885
933
List <Operator > get operators {
886
934
if (_operators != null ) return _operators;
887
935
888
- _operators = _methods.where ((m) => m.isOperator).toList (growable: false )
889
- ..sort (byName);
936
+ _operators = _methods.where ((m) => m.isOperator).toList (growable: false );
937
+
938
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
939
+ if (_operators.isNotEmpty) _operators.sort (byName);
890
940
891
941
return _operators;
892
942
}
@@ -906,8 +956,10 @@ class Class extends ModelElement {
906
956
List <Method > get staticMethods {
907
957
if (_staticMethods != null ) return _staticMethods;
908
958
909
- _staticMethods = _methods.where ((m) => m.isStatic).toList (growable: false )
910
- ..sort (byName);
959
+ _staticMethods = _methods.where ((m) => m.isStatic).toList (growable: false );
960
+
961
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
962
+ if (_staticMethods.isNotEmpty) _staticMethods.sort (byName);
911
963
912
964
return _staticMethods;
913
965
}
@@ -919,7 +971,10 @@ class Class extends ModelElement {
919
971
920
972
_instanceMethods = _methods
921
973
.where ((m) => ! m.isStatic && ! m.isOperator)
922
- .toList (growable: false )..sort (byName);
974
+ .toList (growable: false );
975
+
976
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
977
+ if (_instanceMethods.isNotEmpty) _instanceMethods.sort (byName);
923
978
924
979
return _instanceMethods;
925
980
}
@@ -979,7 +1034,7 @@ class Class extends ModelElement {
979
1034
}
980
1035
}
981
1036
982
- _inheritedMethods.. sort (byName);
1037
+ _inheritedMethods.sort (byName);
983
1038
984
1039
return _inheritedMethods;
985
1040
}
@@ -1038,7 +1093,7 @@ class Class extends ModelElement {
1038
1093
_inheritedOperators.add (new Operator .inherited (value, lib));
1039
1094
}
1040
1095
1041
- _inheritedOperators.. sort (byName);
1096
+ _inheritedOperators.sort (byName);
1042
1097
1043
1098
return _inheritedOperators;
1044
1099
}
@@ -1097,7 +1152,7 @@ class Class extends ModelElement {
1097
1152
}
1098
1153
}
1099
1154
1100
- _inheritedProperties.. sort (byName);
1155
+ _inheritedProperties.sort (byName);
1101
1156
1102
1157
return _inheritedProperties;
1103
1158
}
@@ -1164,14 +1219,18 @@ class Enum extends Class {
1164
1219
.where (isPublic)
1165
1220
.where ((f) => f.isConst)
1166
1221
.map ((field) => new EnumField .forConstant (index++ , field, library))
1167
- .toList (growable: false )..sort (byName);
1222
+ .toList (growable: false );
1223
+
1224
+ // XXX working around a VM SDK issue. Once fixed, you can chain the sort()
1225
+ if (_constants.isNotEmpty) _constants.sort (byName);
1168
1226
1169
1227
return _constants;
1170
1228
}
1171
1229
1172
1230
@override
1173
1231
List <EnumField > get instanceProperties {
1174
- return super .instanceProperties
1232
+ return super
1233
+ .instanceProperties
1175
1234
.map ((Field p) => new EnumField (p.element, p.library))
1176
1235
.toList (growable: false );
1177
1236
}
@@ -1664,8 +1723,10 @@ class ElementType {
1664
1723
1665
1724
ElementType get _returnType {
1666
1725
var rt = (_type as FunctionType ).returnType;
1667
- return new ElementType (rt, new ModelElement .from (
1668
- rt.element, new Library (_element.library.element, _element.package)));
1726
+ return new ElementType (
1727
+ rt,
1728
+ new ModelElement .from (rt.element,
1729
+ new Library (_element.library.element, _element.package)));
1669
1730
}
1670
1731
1671
1732
ModelElement get returnElement {
@@ -1679,9 +1740,9 @@ class ElementType {
1679
1740
1680
1741
List <ElementType > get typeArguments =>
1681
1742
(_type as ParameterizedType ).typeArguments.map ((f) {
1682
- var lib = new Library (f.element.library, _element.package);
1683
- return new ElementType (f, new ModelElement .from (f.element, lib));
1684
- }).toList ();
1743
+ var lib = new Library (f.element.library, _element.package);
1744
+ return new ElementType (f, new ModelElement .from (f.element, lib));
1745
+ }).toList ();
1685
1746
1686
1747
String get linkedName {
1687
1748
if (_linkedName != null ) return _linkedName;
0 commit comments