@@ -1394,16 +1394,26 @@ abstract class GetterSetterCombo implements ModelElement {
13941394
13951395 if (hasGetter && ! getter.element.isSynthetic) {
13961396 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+ }
13991405 }
14001406
14011407 if (hasSetter && ! setter.element.isSynthetic) {
14021408 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+ }
14071417 }
14081418 }
14091419 return buffer.toString ();
@@ -2225,6 +2235,10 @@ abstract class ModelElement extends Nameable
22252235 newModelElement = new Parameter (e, library);
22262236 }
22272237 }
2238+ // TODO(jcollins-g): Consider subclass for ModelFunctionTyped.
2239+ if (e is GenericFunctionTypeElement ) {
2240+ newModelElement = new ModelFunctionTyped (e, library);
2241+ }
22282242 if (newModelElement == null ) throw "Unknown type ${e .runtimeType }" ;
22292243 if (enclosingClass != null ) assert (newModelElement is Inheritable );
22302244 if (library != null ) {
@@ -2333,7 +2347,8 @@ abstract class ModelElement extends Nameable
23332347 return md.map ((dynamic a) {
23342348 String annotation = (const HtmlEscape ()).convert (a.toSource ());
23352349 // 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);
23372352 if (me != null )
23382353 annotation = annotation.replaceFirst (me.name, me.linkedName);
23392354 return annotation;
@@ -2363,7 +2378,7 @@ abstract class ModelElement extends Nameable
23632378 }
23642379
23652380 bool get canHaveParameters =>
2366- element is ExecutableElement || element is FunctionTypeAliasElement ;
2381+ element is ExecutableElement || element is FunctionTypedElement ;
23672382
23682383 List <ModelElement > _documentationFrom;
23692384 // TODO(jcollins-g): untangle when mixins can call super
@@ -2762,13 +2777,8 @@ abstract class ModelElement extends Nameable
27622777
27632778 List <ParameterElement > params;
27642779
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;
27722782 }
27732783
27742784 _parameters = new UnmodifiableListView <Parameter >(params
@@ -3127,12 +3137,25 @@ abstract class ModelElement extends Nameable
31273137 }
31283138}
31293139
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
31313154 with SourceCodeMixin
31323155 implements EnclosedElement {
31333156 List <TypeParameter > typeParameters = [];
31343157
3135- ModelFunction ( FunctionElement element, Library library)
3158+ ModelFunctionTyped ( FunctionTypedElement element, Library library)
31363159 : super (element, library) {
31373160 _modelType = new ElementType (_func.type, this );
31383161 _calcTypeParameters ();
@@ -3162,9 +3185,6 @@ class ModelFunction extends ModelElement
31623185 return '${canonicalLibrary .dirName }/$fileName ' ;
31633186 }
31643187
3165- @override
3166- bool get isStatic => _func.isStatic;
3167-
31683188 @override
31693189 String get kind => 'function' ;
31703190
@@ -3182,7 +3202,7 @@ class ModelFunction extends ModelElement
31823202 return '<${typeParameters .map ((t ) => t .name ).join (', ' )}>' ;
31833203 }
31843204
3185- FunctionElement get _func => (element as FunctionElement );
3205+ FunctionTypedElement get _func => (element as FunctionTypedElement );
31863206}
31873207
31883208/// Something that has a name.
@@ -4229,7 +4249,14 @@ class Parameter extends ModelElement implements EnclosedElement {
42294249 }
42304250
42314251 @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+ }
42334260
42344261 bool get isOptional => _parameter.parameterKind.isOptional;
42354262
0 commit comments