@@ -1394,16 +1394,26 @@ abstract class GetterSetterCombo implements ModelElement {
1394
1394
1395
1395
if (hasGetter && ! getter.element.isSynthetic) {
1396
1396
assert (getter.documentationFrom.length == 1 );
1397
- String docs = getter.documentationFrom.first.computeDocumentationComment;
1398
- if (docs != null ) buffer.write (docs);
1397
+ // We have to check against dropTextFrom here since documentationFrom
1398
+ // doesn't yield the real elements for GetterSetterCombos.
1399
+ if (! config.dropTextFrom
1400
+ .contains (getter.documentationFrom.first.element.library.name)) {
1401
+ String docs =
1402
+ getter.documentationFrom.first.computeDocumentationComment;
1403
+ if (docs != null ) buffer.write (docs);
1404
+ }
1399
1405
}
1400
1406
1401
1407
if (hasSetter && ! setter.element.isSynthetic) {
1402
1408
assert (setter.documentationFrom.length == 1 );
1403
- String docs = setter.documentationFrom.first.computeDocumentationComment;
1404
- if (docs != null ) {
1405
- if (buffer.isNotEmpty) buffer.write ('\n\n ' );
1406
- buffer.write (docs);
1409
+ if (! config.dropTextFrom
1410
+ .contains (setter.documentationFrom.first.element.library.name)) {
1411
+ String docs =
1412
+ setter.documentationFrom.first.computeDocumentationComment;
1413
+ if (docs != null ) {
1414
+ if (buffer.isNotEmpty) buffer.write ('\n\n ' );
1415
+ buffer.write (docs);
1416
+ }
1407
1417
}
1408
1418
}
1409
1419
return buffer.toString ();
@@ -2225,6 +2235,10 @@ abstract class ModelElement extends Nameable
2225
2235
newModelElement = new Parameter (e, library);
2226
2236
}
2227
2237
}
2238
+ // TODO(jcollins-g): Consider subclass for ModelFunctionTyped.
2239
+ if (e is GenericFunctionTypeElement ) {
2240
+ newModelElement = new ModelFunctionTyped (e, library);
2241
+ }
2228
2242
if (newModelElement == null ) throw "Unknown type ${e .runtimeType }" ;
2229
2243
if (enclosingClass != null ) assert (newModelElement is Inheritable );
2230
2244
if (library != null ) {
@@ -2333,7 +2347,8 @@ abstract class ModelElement extends Nameable
2333
2347
return md.map ((dynamic a) {
2334
2348
String annotation = (const HtmlEscape ()).convert (a.toSource ());
2335
2349
// a.element can be null if the element can't be resolved.
2336
- var me = package.findCanonicalModelElementFor (a.element? .enclosingElement);
2350
+ var me =
2351
+ package.findCanonicalModelElementFor (a.element? .enclosingElement);
2337
2352
if (me != null )
2338
2353
annotation = annotation.replaceFirst (me.name, me.linkedName);
2339
2354
return annotation;
@@ -2363,7 +2378,7 @@ abstract class ModelElement extends Nameable
2363
2378
}
2364
2379
2365
2380
bool get canHaveParameters =>
2366
- element is ExecutableElement || element is FunctionTypeAliasElement ;
2381
+ element is ExecutableElement || element is FunctionTypedElement ;
2367
2382
2368
2383
List <ModelElement > _documentationFrom;
2369
2384
// TODO(jcollins-g): untangle when mixins can call super
@@ -2762,13 +2777,8 @@ abstract class ModelElement extends Nameable
2762
2777
2763
2778
List <ParameterElement > params;
2764
2779
2765
- if (element is ExecutableElement ) {
2766
- // the as check silences the warning
2767
- params = (element as ExecutableElement ).parameters;
2768
- }
2769
-
2770
- if (element is FunctionTypeAliasElement ) {
2771
- params = (element as FunctionTypeAliasElement ).parameters;
2780
+ if (element is FunctionTypedElement ) {
2781
+ params = (element as FunctionTypedElement ).parameters;
2772
2782
}
2773
2783
2774
2784
_parameters = new UnmodifiableListView <Parameter >(params
@@ -3127,12 +3137,25 @@ abstract class ModelElement extends Nameable
3127
3137
}
3128
3138
}
3129
3139
3130
- class ModelFunction extends ModelElement
3140
+ class ModelFunction extends ModelFunctionTyped {
3141
+ ModelFunction (FunctionElement element, Library library)
3142
+ : super (element, library);
3143
+
3144
+ @override
3145
+ bool get isStatic {
3146
+ return _func.isStatic;
3147
+ }
3148
+
3149
+ @override
3150
+ FunctionElement get _func => (element as FunctionElement );
3151
+ }
3152
+
3153
+ class ModelFunctionTyped extends ModelElement
3131
3154
with SourceCodeMixin
3132
3155
implements EnclosedElement {
3133
3156
List <TypeParameter > typeParameters = [];
3134
3157
3135
- ModelFunction ( FunctionElement element, Library library)
3158
+ ModelFunctionTyped ( FunctionTypedElement element, Library library)
3136
3159
: super (element, library) {
3137
3160
_modelType = new ElementType (_func.type, this );
3138
3161
_calcTypeParameters ();
@@ -3162,9 +3185,6 @@ class ModelFunction extends ModelElement
3162
3185
return '${canonicalLibrary .dirName }/$fileName ' ;
3163
3186
}
3164
3187
3165
- @override
3166
- bool get isStatic => _func.isStatic;
3167
-
3168
3188
@override
3169
3189
String get kind => 'function' ;
3170
3190
@@ -3182,7 +3202,7 @@ class ModelFunction extends ModelElement
3182
3202
return '<${typeParameters .map ((t ) => t .name ).join (', ' )}>' ;
3183
3203
}
3184
3204
3185
- FunctionElement get _func => (element as FunctionElement );
3205
+ FunctionTypedElement get _func => (element as FunctionTypedElement );
3186
3206
}
3187
3207
3188
3208
/// Something that has a name.
@@ -4229,7 +4249,14 @@ class Parameter extends ModelElement implements EnclosedElement {
4229
4249
}
4230
4250
4231
4251
@override
4232
- String get htmlId => '${_parameter .enclosingElement .name }-param-${name }' ;
4252
+ String get htmlId {
4253
+ String enclosingName = _parameter.enclosingElement.name;
4254
+ if (_parameter.enclosingElement is GenericFunctionTypeElement ) {
4255
+ // TODO(jcollins-g): Drop when GenericFunctionTypeElement populates name.
4256
+ enclosingName = _parameter.enclosingElement.enclosingElement.name;
4257
+ }
4258
+ return '${enclosingName }-param-${name }' ;
4259
+ }
4233
4260
4234
4261
bool get isOptional => _parameter.parameterKind.isOptional;
4235
4262
0 commit comments