@@ -443,7 +443,7 @@ class Class extends ModelElement
443
443
: super (element, library, packageGraph, null ) {
444
444
_mixins = _cls.mixins
445
445
.map ((f) {
446
- ElementType t = new ElementType .from (f, packageGraph);
446
+ DefinedElementType t = new ElementType .from (f, packageGraph);
447
447
return t;
448
448
})
449
449
.where ((mixin ) => mixin != null )
@@ -454,7 +454,7 @@ class Class extends ModelElement
454
454
}
455
455
456
456
_interfaces = _cls.interfaces
457
- .map ((f) => new ElementType .from (f, packageGraph))
457
+ .map ((f) => new ElementType .from (f, packageGraph) as DefinedElementType )
458
458
.toList (growable: false );
459
459
}
460
460
@@ -605,7 +605,7 @@ class Class extends ModelElement
605
605
if (_constructors != null ) return _constructors;
606
606
607
607
_constructors = _cls.constructors.map ((e) {
608
- return new ModelElement .from (e, library, packageGraph);
608
+ return new ModelElement .from (e, library, packageGraph) as Constructor ;
609
609
}).toList (growable: true )
610
610
..sort (byName);
611
611
@@ -818,9 +818,11 @@ class Class extends ModelElement
818
818
819
819
List <Operator > get operators {
820
820
if (_operators != null ) return _operators;
821
-
822
- _operators = _methods.where ((m) => m.isOperator).toList (growable: false )
823
- ..sort (byName);
821
+ _operators = _methods
822
+ .where ((m) => m.isOperator)
823
+ .cast <Operator >()
824
+ .toList (growable: false )
825
+ ..sort (byName);
824
826
_genPageOperators.addAll (_operators);
825
827
826
828
return _operators;
@@ -935,7 +937,9 @@ class Class extends ModelElement
935
937
if (_fields != null ) return _fields;
936
938
_fields = [];
937
939
Set <PropertyAccessorElement > inheritedAccessors = new Set ()
938
- ..addAll (_inheritedElements.where ((e) => e is PropertyAccessorElement ));
940
+ ..addAll (_inheritedElements
941
+ .where ((e) => e is PropertyAccessorElement )
942
+ .cast <PropertyAccessorElement >());
939
943
940
944
// This structure keeps track of inherited accessors, allowing lookup
941
945
// by field name (stripping the '=' from setters).
@@ -1041,7 +1045,7 @@ class Class extends ModelElement
1041
1045
if (_allMethods != null ) return _allMethods;
1042
1046
1043
1047
_allMethods = _cls.methods.map ((e) {
1044
- return new ModelElement .from (e, library, packageGraph);
1048
+ return new ModelElement .from (e, library, packageGraph) as Method ;
1045
1049
}).toList (growable: false )
1046
1050
..sort (byName);
1047
1051
@@ -1052,7 +1056,7 @@ class Class extends ModelElement
1052
1056
@override
1053
1057
List <TypeParameter > get typeParameters => _cls.typeParameters.map ((f) {
1054
1058
var lib = new Library (f.enclosingElement.library, packageGraph);
1055
- return new ModelElement .from (f, lib, packageGraph);
1059
+ return new ModelElement .from (f, lib, packageGraph) as TypeParameter ;
1056
1060
}).toList ();
1057
1061
1058
1062
@override
@@ -1162,7 +1166,7 @@ abstract class Documentable extends Nameable {
1162
1166
abstract class Categorization implements ModelElement {
1163
1167
@override
1164
1168
String _buildDocumentationLocal () {
1165
- _rawDocs = super . _buildDocumentationLocal ();
1169
+ _rawDocs = _buildDocumentationBase ();
1166
1170
_rawDocs = _stripAndSetDartdocCategory (_rawDocs);
1167
1171
return _rawDocs;
1168
1172
}
@@ -1282,7 +1286,7 @@ class Enum extends Class {
1282
1286
.instanceProperties
1283
1287
.map ((Field p) => new ModelElement .from (
1284
1288
p.element, p.library, p.packageGraph,
1285
- getter: p.getter, setter: p.setter))
1289
+ getter: p.getter, setter: p.setter) as EnumField )
1286
1290
.toList (growable: false );
1287
1291
}
1288
1292
@@ -1720,7 +1724,7 @@ abstract class GetterSetterCombo implements ModelElement {
1720
1724
1721
1725
class Library extends ModelElement with Categorization {
1722
1726
List <Class > _classes;
1723
- List <Class > _enums;
1727
+ List <Enum > _enums;
1724
1728
List <ModelFunction > _functions;
1725
1729
List <Typedef > _typeDefs;
1726
1730
List <TopLevelVariable > _variables;
@@ -1931,12 +1935,13 @@ class Library extends ModelElement with Categorization {
1931
1935
1932
1936
List <Class > get enums {
1933
1937
if (_enums != null ) return _enums;
1934
-
1935
1938
List <ClassElement > enumClasses = [];
1936
1939
enumClasses.addAll (_exportedNamespace.definedNames.values
1937
- .where ((element) => element is ClassElement && element.isEnum));
1940
+ .where ((e) => e is ClassElement )
1941
+ .cast <ClassElement >()
1942
+ .where ((element) => element.isEnum));
1938
1943
_enums = enumClasses
1939
- .map ((e) => new ModelElement .from (e, this , packageGraph))
1944
+ .map ((e) => new ModelElement .from (e, this , packageGraph) as Enum )
1940
1945
.toList (growable: false )
1941
1946
..sort (byName);
1942
1947
@@ -1966,10 +1971,11 @@ class Library extends ModelElement with Categorization {
1966
1971
elements.addAll (cu.functions);
1967
1972
}
1968
1973
elements.addAll (_exportedNamespace.definedNames.values
1969
- .where ((element) => element is FunctionElement ));
1974
+ .where ((e) => e is FunctionElement )
1975
+ .cast <FunctionElement >());
1970
1976
1971
1977
_functions = elements.map ((e) {
1972
- return new ModelElement .from (e, this , packageGraph);
1978
+ return new ModelElement .from (e, this , packageGraph) as ModelFunction ;
1973
1979
}).toList (growable: false )
1974
1980
..sort (byName);
1975
1981
@@ -2080,9 +2086,10 @@ class Library extends ModelElement with Categorization {
2080
2086
}
2081
2087
2082
2088
elements.addAll (_exportedNamespace.definedNames.values
2083
- .where ((element) => element is FunctionTypeAliasElement ));
2089
+ .where ((e) => e is FunctionTypeAliasElement )
2090
+ .cast <FunctionTypeAliasElement >());
2084
2091
_typeDefs = elements
2085
- .map ((e) => new ModelElement .from (e, this , packageGraph))
2092
+ .map ((e) => new ModelElement .from (e, this , packageGraph) as Typedef )
2086
2093
.toList (growable: false )
2087
2094
..sort (byName);
2088
2095
@@ -2106,10 +2113,12 @@ class Library extends ModelElement with Categorization {
2106
2113
}
2107
2114
2108
2115
types.addAll (_exportedNamespace.definedNames.values
2109
- .where ((element) => element is ClassElement && ! element.isEnum));
2116
+ .where ((e) => e is ClassElement )
2117
+ .cast <ClassElement >()
2118
+ .where ((element) => ! element.isEnum));
2110
2119
2111
2120
_classes = types
2112
- .map ((e) => new ModelElement .from (e, this , packageGraph))
2121
+ .map ((e) => new ModelElement .from (e, this , packageGraph) as Class )
2113
2122
.toList (growable: false )
2114
2123
..sort (byName);
2115
2124
@@ -2335,7 +2344,7 @@ class Method extends ModelElement
2335
2344
2336
2345
void _calcTypeParameters () {
2337
2346
typeParameters = _method.typeParameters.map ((f) {
2338
- return new ModelElement .from (f, library, packageGraph);
2347
+ return new ModelElement .from (f, library, packageGraph) as TypeParameter ;
2339
2348
}).toList ();
2340
2349
}
2341
2350
@@ -2845,7 +2854,10 @@ abstract class ModelElement extends Canonicalization
2845
2854
return docFrom;
2846
2855
}
2847
2856
2848
- String _buildDocumentationLocal () {
2857
+ String _buildDocumentationLocal () => _buildDocumentationBase ();
2858
+
2859
+ /// Separate from _buildDocumentationLocal for overriding.
2860
+ String _buildDocumentationBase () {
2849
2861
assert (_rawDocs == null );
2850
2862
if (config.dropTextFrom.contains (element.library.name)) {
2851
2863
_rawDocs = '' ;
@@ -3245,8 +3257,9 @@ abstract class ModelElement extends Canonicalization
3245
3257
}
3246
3258
3247
3259
_parameters = new UnmodifiableListView <Parameter >(params
3248
- .map ((p) => new ModelElement .from (p, library, packageGraph))
3249
- .toList () as Iterable <Parameter >);
3260
+ .map ((p) =>
3261
+ new ModelElement .from (p, library, packageGraph) as Parameter )
3262
+ .toList ());
3250
3263
}
3251
3264
return _parameters;
3252
3265
}
@@ -3651,7 +3664,7 @@ class ModelFunctionTyped extends ModelElement
3651
3664
3652
3665
void _calcTypeParameters () {
3653
3666
typeParameters = _func.typeParameters.map ((f) {
3654
- return new ModelElement .from (f, library, packageGraph);
3667
+ return new ModelElement .from (f, library, packageGraph) as TypeParameter ;
3655
3668
}).toList ();
3656
3669
}
3657
3670
@@ -3835,16 +3848,16 @@ class PackageGraph extends Canonicalization
3835
3848
@override
3836
3849
final DartdocConfig config;
3837
3850
3838
- Map <String , Map <String , List < Map < String , dynamic >> >> __crossdartJson;
3851
+ Map <String , Map <String , dynamic >> __crossdartJson;
3839
3852
// TODO(jcollins-g): move to [Package]
3840
- Map <String , Map <String , List < Map < String , dynamic >> >> get crossdartJson {
3853
+ Map <String , Map <String , dynamic >> get crossdartJson {
3841
3854
if (__crossdartJson == null ) {
3842
3855
// TODO(jcollins-g): allow crossdart.json location to be configurable
3843
3856
var crossdartFile =
3844
3857
new File (pathLib.join (config.inputDir.path, "crossdart.json" ));
3845
3858
if (crossdartFile.existsSync ()) {
3846
- var __crossdartJsonTmp = json. decode (crossdartFile. readAsStringSync ())
3847
- as Map < String , Map < String , List < Map < String , dynamic >>>> ;
3859
+ Map < String , dynamic > __crossdartJsonTmp =
3860
+ json. decode (crossdartFile. readAsStringSync ()) ;
3848
3861
__crossdartJson = {};
3849
3862
for (String key in __crossdartJsonTmp.keys) {
3850
3863
__crossdartJson[pathLib.canonicalize (key)] = __crossdartJsonTmp[key];
@@ -4480,8 +4493,10 @@ class PackageGraph extends Canonicalization
4480
4493
// for an inherited element whose defining Class is not canonical.
4481
4494
if (matches.length > 1 && preferredClass != null ) {
4482
4495
// Search for matches inside our superchain.
4483
- List <Class > superChain =
4484
- preferredClass.superChain.map ((et) => et.element).toList ();
4496
+ List <Class > superChain = preferredClass.superChain
4497
+ .map ((et) => et.element)
4498
+ .cast <Class >()
4499
+ .toList ();
4485
4500
superChain.add (preferredClass);
4486
4501
matches.removeWhere ((me) =>
4487
4502
! superChain.contains ((me as EnclosedElement ).enclosingElement));
@@ -5024,7 +5039,7 @@ abstract class TypeParameters implements ModelElement {
5024
5039
}
5025
5040
5026
5041
@override
5027
- DefinedElementType get modelType => super .modelType ;
5042
+ DefinedElementType get modelType;
5028
5043
5029
5044
List <TypeParameter > get typeParameters;
5030
5045
}
@@ -5158,7 +5173,7 @@ class Typedef extends ModelElement
5158
5173
5159
5174
@override
5160
5175
List <TypeParameter > get typeParameters => _typedef.typeParameters.map ((f) {
5161
- return new ModelElement .from (f, library, packageGraph);
5176
+ return new ModelElement .from (f, library, packageGraph) as TypeParameter ;
5162
5177
}).toList ();
5163
5178
}
5164
5179
0 commit comments