From 865b5024863d508fa4daa835c310603daac49807 Mon Sep 17 00:00:00 2001 From: jcollins-g Date: Thu, 29 Mar 2018 09:37:02 -0700 Subject: [PATCH] Fix several problems with anonymous functions and type parameters (#1651) * Have failure example now * Fix a number of anonymous function bugs. * dartfmt * Working * rebuild package docs * tweak style slightly for complicatedReturn * fix crash --- lib/resources/styles.css | 9 + lib/src/element_type.dart | 28 +- lib/src/markdown_processor.dart | 4 +- lib/src/model.dart | 348 ++++++++++-------- test/model_test.dart | 156 +++++--- testing/test_package/lib/fake.dart | 11 + .../test_package_docs/ex/Animal-class.html | 4 +- .../ex/AnotherParameterizedClass-class.html | 4 +- .../AnotherParameterizedClass.html | 6 +- .../AnotherParameterizedClass/hashCode.html | 2 +- .../noSuchMethod.html | 2 +- .../operator_equals.html | 2 +- .../runtimeType.html | 2 +- .../AnotherParameterizedClass/toString.html | 2 +- testing/test_package_docs/ex/Apple-class.html | 4 +- .../ex/Apple/fieldWithTypedef.html | 2 +- .../ex/Apple/whataclass.html | 2 +- testing/test_package_docs/ex/B-class.html | 6 +- testing/test_package_docs/ex/B/list.html | 2 +- testing/test_package_docs/ex/Dog-class.html | 8 +- .../ex/Dog/getAnotherClassD.html | 2 +- .../test_package_docs/ex/Dog/getClassA.html | 2 +- .../test_package_docs/ex/Dog/testGeneric.html | 2 +- .../ex/Dog/testGenericMethod.html | 6 +- testing/test_package_docs/ex/F-class.html | 14 +- testing/test_package_docs/ex/F/F.html | 6 +- .../ex/F/methodWithGenericParam.html | 4 +- testing/test_package_docs/ex/F/test.html | 2 +- .../ex/ParameterizedClass-class.html | 18 +- .../ParameterizedClass.html | 6 +- .../ParameterizedClass/aInheritedField.html | 4 +- .../ParameterizedClass/aInheritedGetter.html | 4 +- .../ParameterizedClass/aInheritedMethod.html | 4 +- .../ParameterizedClass/aInheritedSetter.html | 4 +- .../aInheritedTypedefReturningMethod.html | 4 +- .../ex/ParameterizedClass/hashCode.html | 2 +- .../ex/ParameterizedClass/noSuchMethod.html | 2 +- .../ParameterizedClass/operator_equals.html | 2 +- .../ex/ParameterizedClass/operator_plus.html | 6 +- .../ex/ParameterizedClass/runtimeType.html | 2 +- .../ex/ParameterizedClass/toString.html | 2 +- .../ex/ParameterizedTypedef.html | 4 +- .../ex/TemplatedClass-class.html | 4 +- .../ex/TemplatedClass/TemplatedClass.html | 6 +- .../ex/TemplatedClass/aMethod.html | 2 +- .../ex/TemplatedClass/hashCode.html | 2 +- .../ex/TemplatedClass/noSuchMethod.html | 2 +- .../ex/TemplatedClass/operator_equals.html | 2 +- .../ex/TemplatedClass/runtimeType.html | 2 +- .../ex/TemplatedClass/toString.html | 2 +- .../ex/TemplatedInterface-class.html | 30 +- .../TemplatedInterface.html | 6 +- .../ex/TemplatedInterface/aField.html | 4 +- .../ex/TemplatedInterface/aGetter.html | 4 +- .../TemplatedInterface/aMethodInterface.html | 4 +- .../ex/TemplatedInterface/aSetter.html | 4 +- .../aTypedefReturningMethodInterface.html | 4 +- .../TypedFunctionsWithoutTypedefs-class.html | 10 +- .../getAComplexTypedef.html | 6 +- .../getAFunctionReturningBool.html | 8 +- .../getAFunctionReturningVoid.html | 8 +- .../ex/WithGeneric-class.html | 4 +- .../ex/WithGeneric/WithGeneric.html | 6 +- .../ex/WithGeneric/hashCode.html | 2 +- .../ex/WithGeneric/noSuchMethod.html | 2 +- .../ex/WithGeneric/operator_equals.html | 2 +- .../ex/WithGeneric/prop.html | 2 +- .../ex/WithGeneric/runtimeType.html | 2 +- .../ex/WithGeneric/toString.html | 2 +- .../ex/WithGenericSub-class.html | 2 +- .../test_package_docs/ex/aComplexTypedef.html | 6 +- testing/test_package_docs/ex/ex-library.html | 24 +- .../test_package_docs/ex/genericFunction.html | 6 +- .../test_package_docs/ex/processMessage.html | 4 +- .../fake/ABaseClass-class.html | 2 + .../fake/AClassUsingASuperMixin-class.html | 2 + .../fake/AClassWithFancyProperties-class.html | 2 + .../fake/AMixinCallingSuper-class.html | 2 + .../fake/ATypeTakingClass-class.html | 6 +- .../ATypeTakingClass/ATypeTakingClass.html | 6 +- .../aMethodMaybeReturningVoid.html | 2 +- .../fake/ATypeTakingClass/hashCode.html | 2 +- .../fake/ATypeTakingClass/noSuchMethod.html | 2 +- .../ATypeTakingClass/operator_equals.html | 2 +- .../fake/ATypeTakingClass/runtimeType.html | 2 +- .../fake/ATypeTakingClass/toString.html | 2 +- .../fake/ATypeTakingClassMixedIn-class.html | 4 +- .../fake/Annotation-class.html | 2 + .../fake/AnotherInterface-class.html | 2 + .../fake/BaseForDocComments-class.html | 2 + .../fake/BaseThingy-class.html | 2 + .../fake/BaseThingy2-class.html | 2 + .../fake/CUSTOM_CLASS-constant.html | 2 + .../fake/CUSTOM_CLASS_PRIVATE-constant.html | 2 + testing/test_package_docs/fake/Callback2.html | 2 + .../ClassWithUnusualProperties-class.html | 6 +- .../explicitGetterImplicitSetter.html | 4 +- .../explicitSetter.html | 2 +- .../test_package_docs/fake/Color-class.html | 6 +- .../fake/ConstantClass-class.html | 2 + .../fake/ConstructorTester-class.html | 6 +- .../ConstructorTester.fromSomething.html | 6 +- .../ConstructorTester/ConstructorTester.html | 6 +- .../fake/ConstructorTester/hashCode.html | 2 +- .../fake/ConstructorTester/noSuchMethod.html | 2 +- .../ConstructorTester/operator_equals.html | 2 +- .../fake/ConstructorTester/runtimeType.html | 2 +- .../fake/ConstructorTester/toString.html | 2 +- .../test_package_docs/fake/Cool-class.html | 2 + .../test_package_docs/fake/DOWN-constant.html | 2 + .../fake/DocumentWithATable-class.html | 2 + testing/test_package_docs/fake/Doh-class.html | 2 + .../fake/ExtendsFutureVoid-class.html | 20 +- .../ExtendsFutureVoid/ExtendsFutureVoid.html | 2 +- .../fake/ExtendsFutureVoid/asStream.html | 2 +- .../fake/ExtendsFutureVoid/catchError.html | 2 +- .../fake/ExtendsFutureVoid/then.html | 8 +- .../fake/ExtendsFutureVoid/timeout.html | 4 +- .../fake/ExtendsFutureVoid/whenComplete.html | 2 +- .../fake/ExtraSpecialList-class.html | 32 +- .../ExtraSpecialList/ExtraSpecialList.html | 6 +- .../test_package_docs/fake/FakeProcesses.html | 2 + .../test_package_docs/fake/Foo2-class.html | 2 + .../fake/GenericTypedef.html | 6 +- .../fake/HasGenericWithExtends-class.html | 6 +- .../HasGenericWithExtends.html | 6 +- .../fake/HasGenericWithExtends/hashCode.html | 2 +- .../HasGenericWithExtends/noSuchMethod.html | 2 +- .../operator_equals.html | 2 +- .../HasGenericWithExtends/runtimeType.html | 2 +- .../fake/HasGenericWithExtends/toString.html | 2 +- .../fake/HasGenerics-class.html | 8 +- .../fake/HasGenerics/HasGenerics.html | 6 +- .../fake/HasGenerics/convertToMap.html | 4 +- .../fake/HasGenerics/doStuff.html | 2 +- .../fake/HasGenerics/hashCode.html | 2 +- .../fake/HasGenerics/noSuchMethod.html | 2 +- .../fake/HasGenerics/operator_equals.html | 2 +- .../fake/HasGenerics/returnX.html | 2 +- .../fake/HasGenerics/returnZ.html | 2 +- .../fake/HasGenerics/runtimeType.html | 2 +- .../fake/HasGenerics/toString.html | 2 +- .../fake/ImplementingThingy-class.html | 2 + .../fake/ImplementingThingy2-class.html | 2 + .../fake/ImplementsFutureVoid-class.html | 18 +- .../fake/ImplementsFutureVoid/asStream.html | 2 +- .../fake/ImplementsFutureVoid/catchError.html | 2 +- .../fake/ImplementsFutureVoid/then.html | 8 +- .../fake/ImplementsFutureVoid/timeout.html | 4 +- .../ImplementsFutureVoid/whenComplete.html | 2 +- .../fake/ImplicitProperties-class.html | 4 +- .../explicitGetterImplicitSetter.html | 2 +- .../fake/InheritingClassOne-class.html | 2 + .../fake/InheritingClassTwo-class.html | 2 + .../fake/Interface-class.html | 2 + .../fake/LongFirstLine-class.html | 4 +- .../fake/LotsAndLotsOfParameters.html | 2 + .../fake/MIEEBase-class.html | 8 +- .../fake/MIEEBase/MIEEBase.html | 6 +- .../fake/MIEEMixin-class.html | 8 +- .../fake/MIEEMixin/MIEEMixin.html | 6 +- .../fake/MIEEMixin/operator_put.html | 2 +- .../fake/MIEEMixinWithOverride-class.html | 10 +- .../MIEEMixinWithOverride.html | 6 +- .../MIEEMixinWithOverride/operator_put.html | 2 +- .../fake/MIEEThing-class.html | 6 +- .../fake/MIEEThing/MIEEThing.html | 6 +- .../fake/MIEEThing/hashCode.html | 2 +- .../fake/MIEEThing/noSuchMethod.html | 2 +- .../fake/MIEEThing/operator_equals.html | 2 +- .../fake/MIEEThing/operator_put.html | 2 +- .../fake/MIEEThing/runtimeType.html | 2 +- .../fake/MIEEThing/toString.html | 2 +- .../test_package_docs/fake/MixMeIn-class.html | 2 + .../fake/NAME_SINGLEUNDERSCORE-constant.html | 2 + .../NAME_WITH_TWO_UNDERSCORES-constant.html | 2 + .../fake/NewGenericTypedef.html | 10 +- .../fake/NotAMixin-class.html | 2 + .../test_package_docs/fake/Oops-class.html | 2 + .../fake/OperatorReferenceClass-class.html | 2 + .../fake/OtherGenericsThing-class.html | 8 +- .../OtherGenericsThing.html | 6 +- .../fake/OtherGenericsThing/convert.html | 4 +- .../fake/OtherGenericsThing/hashCode.html | 2 +- .../fake/OtherGenericsThing/noSuchMethod.html | 2 +- .../OtherGenericsThing/operator_equals.html | 2 +- .../fake/OtherGenericsThing/runtimeType.html | 2 +- .../fake/OtherGenericsThing/toString.html | 2 +- .../test_package_docs/fake/PI-constant.html | 2 + .../fake/ReferringClass-class.html | 2 + .../fake/SpecialList-class.html | 72 ++-- .../fake/SpecialList/SpecialList.html | 6 +- .../fake/SpecialList/add.html | 2 +- .../fake/SpecialList/addAll.html | 4 +- .../fake/SpecialList/any.html | 2 +- .../fake/SpecialList/asMap.html | 4 +- .../fake/SpecialList/cast.html | 10 +- .../fake/SpecialList/clear.html | 2 +- .../fake/SpecialList/contains.html | 2 +- .../fake/SpecialList/elementAt.html | 2 +- .../fake/SpecialList/every.html | 2 +- .../fake/SpecialList/expand.html | 10 +- .../fake/SpecialList/fillRange.html | 2 +- .../fake/SpecialList/first.html | 2 +- .../fake/SpecialList/firstWhere.html | 2 +- .../fake/SpecialList/fold.html | 8 +- .../fake/SpecialList/followedBy.html | 6 +- .../fake/SpecialList/forEach.html | 2 +- .../fake/SpecialList/getRange.html | 4 +- .../fake/SpecialList/hashCode.html | 2 +- .../fake/SpecialList/indexOf.html | 2 +- .../fake/SpecialList/indexWhere.html | 2 +- .../fake/SpecialList/insert.html | 2 +- .../fake/SpecialList/insertAll.html | 4 +- .../fake/SpecialList/isEmpty.html | 2 +- .../fake/SpecialList/isNotEmpty.html | 2 +- .../fake/SpecialList/iterator.html | 4 +- .../fake/SpecialList/join.html | 2 +- .../fake/SpecialList/last.html | 2 +- .../fake/SpecialList/lastIndexOf.html | 2 +- .../fake/SpecialList/lastIndexWhere.html | 2 +- .../fake/SpecialList/lastWhere.html | 2 +- .../fake/SpecialList/length.html | 2 +- .../fake/SpecialList/map.html | 10 +- .../fake/SpecialList/noSuchMethod.html | 2 +- .../fake/SpecialList/operator_equals.html | 2 +- .../fake/SpecialList/operator_get.html | 2 +- .../fake/SpecialList/operator_plus.html | 6 +- .../fake/SpecialList/operator_put.html | 2 +- .../fake/SpecialList/reduce.html | 2 +- .../fake/SpecialList/remove.html | 2 +- .../fake/SpecialList/removeAt.html | 2 +- .../fake/SpecialList/removeLast.html | 2 +- .../fake/SpecialList/removeRange.html | 2 +- .../fake/SpecialList/removeWhere.html | 2 +- .../fake/SpecialList/replaceRange.html | 4 +- .../fake/SpecialList/retainWhere.html | 2 +- .../fake/SpecialList/retype.html | 10 +- .../fake/SpecialList/reversed.html | 4 +- .../fake/SpecialList/runtimeType.html | 2 +- .../fake/SpecialList/setAll.html | 4 +- .../fake/SpecialList/setRange.html | 4 +- .../fake/SpecialList/shuffle.html | 2 +- .../fake/SpecialList/single.html | 2 +- .../fake/SpecialList/singleWhere.html | 2 +- .../fake/SpecialList/skip.html | 4 +- .../fake/SpecialList/skipWhile.html | 4 +- .../fake/SpecialList/sort.html | 2 +- .../fake/SpecialList/sublist.html | 4 +- .../fake/SpecialList/take.html | 4 +- .../fake/SpecialList/takeWhile.html | 4 +- .../fake/SpecialList/toList.html | 4 +- .../fake/SpecialList/toSet.html | 4 +- .../fake/SpecialList/toString.html | 2 +- .../fake/SpecialList/where.html | 4 +- .../fake/SpecialList/whereType.html | 10 +- .../fake/SubForDocComments-class.html | 2 + .../fake/SuperAwesomeClass-class.html | 4 +- .../fake/SuperAwesomeClass/powers.html | 2 +- .../fake/TypedefUsingClass-class.html | 6 +- .../TypedefUsingClass/TypedefUsingClass.html | 2 +- .../fake/TypedefUsingClass/x.html | 2 +- .../test_package_docs/fake/UP-constant.html | 2 + .../test_package_docs/fake/VoidCallback.html | 2 + .../fake/WithGetterAndSetter-class.html | 2 + .../test_package_docs/fake/ZERO-constant.html | 2 + .../test_package_docs/fake/aCoolVariable.html | 2 + .../fake/aVoidParameter.html | 4 +- .../test_package_docs/fake/addCallback.html | 2 + .../test_package_docs/fake/addCallback2.html | 2 + .../fake/complicatedReturn.html | 197 ++++++++++ .../test_package_docs/fake/dynamicGetter.html | 2 + .../test_package_docs/fake/fake-library.html | 66 ++-- .../fake/functionWithFunctionParameters.html | 2 + .../fake/getterSetterNodocGetter.html | 2 + .../fake/getterSetterNodocSetter.html | 2 + .../fake/greatAnnotation-constant.html | 2 + .../fake/greatestAnnotation-constant.html | 2 + .../fake/importantComputations.html | 193 ++++++++++ .../fake/incorrectDocReference-constant.html | 2 + .../test_package_docs/fake/justGetter.html | 2 + .../test_package_docs/fake/justSetter.html | 2 + .../fake/mapWithDynamicKeys.html | 4 +- .../test_package_docs/fake/meaningOfLife.html | 2 + .../test_package_docs/fake/myCoolTypedef.html | 2 + .../fake/myGenericFunction.html | 8 +- .../fake/myMap-constant.html | 2 + .../onlyPositionalWithNoDefaultNoType.html | 2 + .../test_package_docs/fake/paintImage1.html | 2 + .../test_package_docs/fake/paintImage2.html | 2 + .../fake/paramFromAnotherLib.html | 2 + .../fake/paramOfFutureOrNull.html | 4 +- .../fake/required-constant.html | 2 + .../fake/returningFutureVoid.html | 4 +- testing/test_package_docs/fake/setAndGet.html | 2 + testing/test_package_docs/fake/short.html | 2 + .../fake/simpleProperty.html | 2 + testing/test_package_docs/fake/soIntense.html | 2 + ...testingCodeSyntaxInOneLiners-constant.html | 2 + .../fake/thisIsAlsoAsync.html | 2 + .../test_package_docs/fake/thisIsAsync.html | 2 + .../fake/thisIsFutureOr.html | 2 + .../fake/thisIsFutureOrNull.html | 4 +- .../fake/thisIsFutureOrT.html | 10 +- .../fake/topLevelFunction.html | 2 + .../fake/typeParamOfFutureOr.html | 8 +- testing/test_package_docs/index.json | 22 ++ .../static-assets/styles.css | 9 + .../Whataclass-class.html | 4 +- .../Whataclass/Whataclass.html | 6 +- .../Whataclass/hashCode.html | 2 +- .../Whataclass/noSuchMethod.html | 2 +- .../Whataclass/operator_equals.html | 2 +- .../Whataclass/runtimeType.html | 2 +- .../Whataclass/toString.html | 2 +- .../test_package_imported.main-library.html | 2 +- 316 files changed, 1502 insertions(+), 747 deletions(-) create mode 100644 testing/test_package_docs/fake/complicatedReturn.html create mode 100644 testing/test_package_docs/fake/importantComputations.html diff --git a/lib/resources/styles.css b/lib/resources/styles.css index 56648e9fec..ffedb90d4f 100644 --- a/lib/resources/styles.css +++ b/lib/resources/styles.css @@ -359,6 +359,15 @@ dl dt.callable .name { white-space: nowrap; } +.type-parameter { + white-space: nowrap; +} + +.multi-line-signature .type-parameter .parameter { + margin-left: 0px; + display: unset; +} + .signature { color: #727272; } diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index ffe3886a25..4e677f4d3f 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -29,8 +29,6 @@ abstract class ElementType extends Privacy { assert(f is ParameterizedType || f is TypeParameterType); bool isGenericTypeAlias = f.element.enclosingElement is GenericTypeAliasElement; - // can happen if element is dynamic - assert(f.element.library != null); if (f is FunctionType) { assert(f is ParameterizedType); if (isGenericTypeAlias) { @@ -38,9 +36,7 @@ abstract class ElementType extends Privacy { return new CallableGenericTypeAliasElementType( f, packageGraph, element, returnedFrom); } else { - if ((f.name ?? f.element.name) == '' || - (f.name ?? f.element.name) == null) { - assert(element is ModelFunctionAnonymous); + if (element is ModelFunctionAnonymous) { return new CallableAnonymousElementType( f, packageGraph, element, returnedFrom); } else { @@ -129,9 +125,10 @@ class ParameterizedElementType extends DefinedElementType { if (!typeArguments.every((t) => t.name == 'dynamic') && typeArguments.isNotEmpty) { buf.write(''); - buf.write('<'); - buf.writeAll(typeArguments.map((t) => t.linkedName), ', '); - buf.write('>'); + buf.write('<'); + buf.writeAll(typeArguments.map((t) => t.linkedName), + ', '); + buf.write('>'); buf.write(''); } @@ -150,9 +147,10 @@ class ParameterizedElementType extends DefinedElementType { if (!typeArguments.every((t) => t.name == 'dynamic') && typeArguments.isNotEmpty) { - buf.write('<'); - buf.writeAll(typeArguments.map((t) => t.nameWithGenerics), ', '); - buf.write('>'); + buf.write('<'); + buf.writeAll(typeArguments.map((t) => t.nameWithGenerics), + ', '); + buf.write('>'); } _nameWithGenerics = buf.toString(); } @@ -286,6 +284,12 @@ class CallableElementType extends ParameterizedElementType CallableElementType(FunctionType t, PackageGraph packageGraph, ModelElement element, ElementType returnedFrom) : super(t, packageGraph, element, returnedFrom); + + @override + String get linkedName { + if (name != null && name.isNotEmpty) return super.linkedName; + return '${nameWithGenerics}(${element.linkedParams(showNames: false).trim()}) → ${returnType.linkedName}'; + } } /// This is an anonymous function using the generic function syntax (declared @@ -301,7 +305,7 @@ class CallableAnonymousElementType extends CallableElementType { String get linkedName { if (_linkedName == null) { _linkedName = - '${super.linkedName}(${element.linkedParams()})'; + '${returnType.linkedName} ${super.linkedName}(${element.linkedParams()})'; } return _linkedName; } diff --git a/lib/src/markdown_processor.dart b/lib/src/markdown_processor.dart index 6f0f67ef2c..12dda17563 100644 --- a/lib/src/markdown_processor.dart +++ b/lib/src/markdown_processor.dart @@ -565,8 +565,8 @@ ModelElement _findRefElementInLibrary(String codeRef, Warnable element, } if (results.length > 1) { - if (results.any((r) => r.library.packageName == library.packageName)) { - results.removeWhere((r) => r.library.packageName != library.packageName); + if (results.any((r) => r.library?.packageName == library.packageName)) { + results.removeWhere((r) => r.library?.packageName != library.packageName); } } diff --git a/lib/src/model.dart b/lib/src/model.dart index cb094d873e..d5e2fbac75 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -225,23 +225,26 @@ class InheritableAccessor extends Accessor with Inheritable { InheritableAccessor accessor; if (element == null) return null; if (inheritedAccessors.contains(element)) { - accessor = new ModelElement.from(element, enclosingClass.library, + accessor = new ModelElement.from( + element, enclosingClass.library, enclosingClass.packageGraph, enclosingClass: enclosingClass); } else { - accessor = new ModelElement.from(element, enclosingClass.library); + accessor = new ModelElement.from( + element, enclosingClass.library, enclosingClass.packageGraph); } return accessor; } ModelElement _enclosingElement; bool _isInherited = false; - InheritableAccessor(PropertyAccessorElement element, Library library) - : super(element, library, null); + InheritableAccessor(PropertyAccessorElement element, Library library, + PackageGraph packageGraph) + : super(element, library, packageGraph, null); - InheritableAccessor.inherited( - PropertyAccessorElement element, Library library, this._enclosingElement, + InheritableAccessor.inherited(PropertyAccessorElement element, + Library library, PackageGraph packageGraph, this._enclosingElement, {Member originalMember}) - : super(element, library, originalMember) { + : super(element, library, packageGraph, originalMember) { _isInherited = true; } @@ -270,9 +273,9 @@ class Accessor extends ModelElement implements EnclosedElement { GetterSetterCombo _enclosingCombo; - Accessor( - PropertyAccessorElement element, Library library, Member originalMember) - : super(element, library, originalMember); + Accessor(PropertyAccessorElement element, Library library, + PackageGraph packageGraph, Member originalMember) + : super(element, library, packageGraph, originalMember); get linkedReturnType { assert(isGetter); @@ -370,7 +373,8 @@ class Accessor extends ModelElement .findOrCreateLibraryFor(_accessor.enclosingElement.enclosingElement); } - return new ModelElement.from(_accessor.enclosingElement, library); + return new ModelElement.from( + _accessor.enclosingElement, library, packageGraph); } @override @@ -458,7 +462,8 @@ class Class extends ModelElement List _inheritedProperties; List _allInstanceProperties; - Class(ClassElement element, Library library) : super(element, library, null) { + Class(ClassElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph, null) { _mixins = _cls.mixins .map((f) { ElementType t = new ElementType.from(f, packageGraph); @@ -623,7 +628,7 @@ class Class extends ModelElement if (_constructors != null) return _constructors; _constructors = _cls.constructors.map((e) { - return new ModelElement.from(e, library); + return new ModelElement.from(e, library, packageGraph); }).toList(growable: true) ..sort(byName); @@ -712,7 +717,8 @@ class Class extends ModelElement }).toSet(); for (ExecutableElement e in inheritedMethodElements) { - Method m = new ModelElement.from(e, library, enclosingClass: this); + Method m = new ModelElement.from(e, library, packageGraph, + enclosingClass: this); _inheritedMethods.add(m); _genPageMethods.add(m); } @@ -737,7 +743,8 @@ class Class extends ModelElement !operatorNames.contains(e.name)); }).toSet(); for (ExecutableElement e in inheritedOperatorElements) { - Operator o = new ModelElement.from(e, library, enclosingClass: this); + Operator o = new ModelElement.from(e, library, packageGraph, + enclosingClass: this); _inheritedOperators.add(o); _genPageOperators.add(o); } @@ -1038,14 +1045,15 @@ class Class extends ModelElement if ((getter == null || getter.isInherited) && (setter == null || setter.isInherited)) { // Field is 100% inherited. - field = new ModelElement.from(f, library, + field = new ModelElement.from(f, library, packageGraph, enclosingClass: this, getter: getter, setter: setter); } else { // Field is <100% inherited (could be half-inherited). // TODO(jcollins-g): Navigation is probably still confusing for // half-inherited fields when traversing the inheritance tree. Make // this better, somehow. - field = new ModelElement.from(f, library, getter: getter, setter: setter); + field = new ModelElement.from(f, library, packageGraph, + getter: getter, setter: setter); } _fields.add(field); } @@ -1056,7 +1064,7 @@ class Class extends ModelElement if (_allMethods != null) return _allMethods; _allMethods = _cls.methods.map((e) { - return new ModelElement.from(e, library); + return new ModelElement.from(e, library, packageGraph); }).toList(growable: false) ..sort(byName); @@ -1067,7 +1075,7 @@ class Class extends ModelElement @override List get typeParameters => _cls.typeParameters.map((f) { var lib = new Library(f.enclosingElement.library, packageGraph); - return new ModelElement.from(f, lib); + return new ModelElement.from(f, lib, packageGraph); }).toList(); @override @@ -1081,8 +1089,9 @@ class Class extends ModelElement class Constructor extends ModelElement with SourceCodeMixin, TypeParameters implements EnclosedElement { - Constructor(ConstructorElement element, Library library) - : super(element, library, null); + Constructor( + ConstructorElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph, null); @override // TODO(jcollins-g): Revisit this when dart-lang/sdk#31517 is implemented. @@ -1090,8 +1099,8 @@ class Constructor extends ModelElement (enclosingElement as Class).typeParameters; @override - ModelElement get enclosingElement => - new ModelElement.from(_constructor.enclosingElement, library); + ModelElement get enclosingElement => new ModelElement.from( + _constructor.enclosingElement, library, packageGraph); String get fullKind { if (isConst) return 'const $kind'; @@ -1259,15 +1268,8 @@ abstract class Canonicalization extends Object } class Dynamic extends ModelElement { - @override - PackageGraph packageGraph; - - Dynamic(Element element, Library library, PackageGraph p) - : super(element, library, null) { - packageGraph = p; - assert(packageGraph != null || library != null); - if (p == null) packageGraph = library.packageGraph; - } + Dynamic(Element element, PackageGraph packageGraph) + : super(element, null, packageGraph, null); @override ModelElement get enclosingElement => throw new UnsupportedError(''); @@ -1290,13 +1292,15 @@ abstract class EnclosedElement { } class Enum extends Class { - Enum(ClassElement element, Library library) : super(element, library); + Enum(ClassElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph); @override List get instanceProperties { return super .instanceProperties - .map((Field p) => new ModelElement.from(p.element, p.library, + .map((Field p) => new ModelElement.from( + p.element, p.library, p.packageGraph, getter: p.getter, setter: p.setter)) .toList(growable: false); } @@ -1313,18 +1317,18 @@ class Enum extends Class { class EnumField extends Field { int _index; - EnumField( - FieldElement element, Library library, Accessor getter, Accessor setter) - : super(element, library, getter, setter); + EnumField(FieldElement element, Library library, PackageGraph packageGraph, + Accessor getter, Accessor setter) + : super(element, library, packageGraph, getter, setter); - EnumField.forConstant( - this._index, FieldElement element, Library library, Accessor getter) - : super(element, library, getter, null); + EnumField.forConstant(this._index, FieldElement element, Library library, + PackageGraph packageGraph, Accessor getter) + : super(element, library, packageGraph, getter, null); @override String get constantValueBase { if (name == 'values') { - return 'const List<${_field.enclosingElement.name}>'; + return 'const List<${_field.enclosingElement.name}>'; } else { return 'const ${_field.enclosingElement.name}($_index)'; } @@ -1388,16 +1392,22 @@ class Field extends ModelElement @override final InheritableAccessor setter; - Field(FieldElement element, Library library, this.getter, this.setter) - : super(element, library, null) { + Field(FieldElement element, Library library, PackageGraph packageGraph, + this.getter, this.setter) + : super(element, library, packageGraph, null) { if (getter != null) getter.enclosingCombo = this; if (setter != null) setter.enclosingCombo = this; _setModelType(); } - factory Field.inherited(FieldElement element, Class enclosingClass, - Library library, Accessor getter, Accessor setter) { - Field newField = new Field(element, library, getter, setter); + factory Field.inherited( + FieldElement element, + Class enclosingClass, + Library library, + PackageGraph packageGraph, + Accessor getter, + Accessor setter) { + Field newField = new Field(element, library, packageGraph, getter, setter); newField._isInherited = true; newField._enclosingClass = enclosingClass; // Can't set _isInherited to true if this is the defining element, because @@ -1422,7 +1432,8 @@ class Field extends ModelElement @override ModelElement get enclosingElement { if (_enclosingClass == null) { - _enclosingClass = new ModelElement.from(_field.enclosingElement, library); + _enclosingClass = + new ModelElement.from(_field.enclosingElement, library, packageGraph); } return _enclosingClass; } @@ -1727,9 +1738,6 @@ abstract class GetterSetterCombo implements ModelElement { } class Library extends ModelElement with Categorization { - @override - final PackageGraph packageGraph; - List _classes; List _enums; List _functions; @@ -1741,8 +1749,8 @@ class Library extends ModelElement with Categorization { return packageGraph.findOrCreateLibraryFor(element); } - Library._(LibraryElement element, this.packageGraph) - : super(element, null, null) { + Library._(LibraryElement element, PackageGraph packageGraph) + : super(element, null, packageGraph, null) { if (element == null) throw new ArgumentError.notNull('element'); _exportedNamespace = new NamespaceBuilder().createExportNamespaceForLibrary(element); @@ -1771,8 +1779,8 @@ class Library extends ModelElement with Categorization { new ModelElement.fromElement(e.setter.element, packageGraph); } } - return new ModelElement.from( - e.element, packageGraph.findOrCreateLibraryFor(e.element), + return new ModelElement.from(e.element, + packageGraph.findOrCreateLibraryFor(e.element), packageGraph, getter: getter, setter: setter) .fullyQualifiedName; }).toList(); @@ -1856,7 +1864,7 @@ class Library extends ModelElement with Categorization { importedExportedLibraryElements .addAll((element as LibraryElement).exportedLibraries); for (LibraryElement l in importedExportedLibraryElements) { - Library lib = new ModelElement.from(l, library); + Library lib = new ModelElement.from(l, library, packageGraph); _importedExportedLibraries.add(lib); _importedExportedLibraries.addAll(lib.importedExportedLibraries); } @@ -1933,7 +1941,7 @@ class Library extends ModelElement with Categorization { enumClasses.addAll(_exportedNamespace.definedNames.values .where((element) => element is ClassElement && element.isEnum)); _enums = enumClasses - .map((e) => new ModelElement.from(e, this)) + .map((e) => new ModelElement.from(e, this, packageGraph)) .toList(growable: false) ..sort(byName); @@ -1966,7 +1974,7 @@ class Library extends ModelElement with Categorization { .where((element) => element is FunctionElement)); _functions = elements.map((e) { - return new ModelElement.from(e, this); + return new ModelElement.from(e, this, packageGraph); }).toList(growable: false) ..sort(byName); @@ -2081,7 +2089,7 @@ class Library extends ModelElement with Categorization { elements.addAll(_exportedNamespace.definedNames.values .where((element) => element is FunctionTypeAliasElement)); _typeDefs = elements - .map((e) => new ModelElement.from(e, this)) + .map((e) => new ModelElement.from(e, this, packageGraph)) .toList(growable: false) ..sort(byName); @@ -2108,7 +2116,7 @@ class Library extends ModelElement with Categorization { .where((element) => element is ClassElement && !element.isEnum)); _classes = types - .map((e) => new ModelElement.from(e, this)) + .map((e) => new ModelElement.from(e, this, packageGraph)) .toList(growable: false) ..sort(byName); @@ -2150,12 +2158,12 @@ class Library extends ModelElement with Categorization { for (TopLevelVariableElement element in elements) { Accessor getter; if (element.getter != null) - getter = new ModelElement.from(element.getter, this); + getter = new ModelElement.from(element.getter, this, packageGraph); Accessor setter; if (element.setter != null) - setter = new ModelElement.from(element.setter, this); - ModelElement me = - new ModelElement.from(element, this, getter: getter, setter: setter); + setter = new ModelElement.from(element.setter, this, packageGraph); + ModelElement me = new ModelElement.from(element, this, packageGraph, + getter: getter, setter: setter); _variables.add(me); } @@ -2319,29 +2327,30 @@ class Method extends ModelElement @override List typeParameters = []; - Method(MethodElement element, Library library) - : super(element, library, null) { + Method(MethodElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph, null) { _calcTypeParameters(); } Method.inherited(MethodElement element, this._enclosingClass, Library library, + PackageGraph packageGraph, {Member originalMember}) - : super(element, library, originalMember) { + : super(element, library, packageGraph, originalMember) { _isInherited = true; _calcTypeParameters(); } void _calcTypeParameters() { typeParameters = _method.typeParameters.map((f) { - return new ModelElement.from(f, library); + return new ModelElement.from(f, library, packageGraph); }).toList(); } @override ModelElement get enclosingElement { if (_enclosingClass == null) { - _enclosingClass = - new ModelElement.from(_method.enclosingElement, library); + _enclosingClass = new ModelElement.from( + _method.enclosingElement, library, packageGraph); } return _enclosingClass; } @@ -2439,9 +2448,10 @@ class ScoredCandidate implements Comparable { ModelElement resolveMultiplyInheritedElement( MultiplyInheritedExecutableElement e, Library library, + PackageGraph packageGraph, Class enclosingClass) { - Iterable inheritables = e.inheritedElements.map((ee) => - new ModelElement.fromElement(ee, library.packageGraph) as Inheritable); + Iterable inheritables = e.inheritedElements.map( + (ee) => new ModelElement.fromElement(ee, packageGraph) as Inheritable); Inheritable foundInheritable; int lowIndex = enclosingClass.inheritanceChain.length; for (var inheritable in inheritables) { @@ -2452,7 +2462,7 @@ ModelElement resolveMultiplyInheritedElement( lowIndex = index; } } - return new ModelElement.from(foundInheritable.element, library, + return new ModelElement.from(foundInheritable.element, library, packageGraph, enclosingClass: enclosingClass); } @@ -2506,11 +2516,12 @@ abstract class ModelElement extends Canonicalization // TODO(jcollins-g): make _originalMember optional after dart-lang/sdk#15101 // is fixed. - ModelElement(this._element, this._library, this._originalMember) {} + ModelElement( + this._element, this._library, this._packageGraph, this._originalMember) {} factory ModelElement.fromElement(Element e, PackageGraph p) { Library lib = _findOrCreateEnclosingLibraryForStatic(e, p); - return new ModelElement.from(e, lib, packageGraph: p); + return new ModelElement.from(e, lib, p); } // TODO(jcollins-g): this way of using the optional parameter is messy, @@ -2523,11 +2534,14 @@ abstract class ModelElement extends Canonicalization // parameter when given a null. /// Do not construct any ModelElements unless they are from this constructor. /// Specify enclosingClass only if this is to be an inherited object. - factory ModelElement.from(Element e, Library library, - {Class enclosingClass, - Accessor getter, - Accessor setter, - PackageGraph packageGraph}) { + factory ModelElement.from( + Element e, Library library, PackageGraph packageGraph, + {Class enclosingClass, Accessor getter, Accessor setter}) { + assert(packageGraph != null && e != null); + assert(library != null || + e is ParameterElement || + e is TypeParameterElement || + e is GenericFunctionTypeElementImpl); // With AnalysisDriver, we sometimes get ElementHandles when building // docs for the SDK, seen via [Library.importedExportedLibraries]. Why? if (e is ElementHandle) { @@ -2546,24 +2560,24 @@ abstract class ModelElement extends Canonicalization new Tuple3(e, library, enclosingClass); ModelElement newModelElement; if (e.kind != ElementKind.DYNAMIC && - library.packageGraph._allConstructedModelElements.containsKey(key)) { - newModelElement = library.packageGraph._allConstructedModelElements[key]; + packageGraph._allConstructedModelElements.containsKey(key)) { + newModelElement = packageGraph._allConstructedModelElements[key]; assert(newModelElement.element is! MultiplyInheritedExecutableElement); } else { if (e.kind == ElementKind.DYNAMIC) { - newModelElement = new Dynamic(e, library, packageGraph); + newModelElement = new Dynamic(e, packageGraph); } if (e is MultiplyInheritedExecutableElement) { - newModelElement = - resolveMultiplyInheritedElement(e, library, enclosingClass); + newModelElement = resolveMultiplyInheritedElement( + e, library, packageGraph, enclosingClass); } else { if (e is LibraryElement) { - newModelElement = new Library(e, library.packageGraph); + newModelElement = new Library(e, packageGraph); } // Also handles enums if (e is ClassElement) { if (!e.isEnum) { - newModelElement = new Class(e, library); + newModelElement = new Class(e, library, packageGraph); if (newModelElement.name == 'Object' && newModelElement.library.name == 'dart:core') { // We've found Object. This is an important object, so save it in the package. @@ -2580,63 +2594,69 @@ abstract class ModelElement extends Canonicalization newModelElement; } } else { - newModelElement = new Enum(e, library); + newModelElement = new Enum(e, library, packageGraph); } } if (e is FunctionElement) { - newModelElement = new ModelFunction(e, library); + newModelElement = new ModelFunction(e, library, packageGraph); } else if (e is GenericFunctionTypeElement) { if (e is FunctionTypeAliasElement) { assert(e.name != ''); - newModelElement = new ModelFunctionTypedef(e, library); + newModelElement = + new ModelFunctionTypedef(e, library, packageGraph); } else { if (e.enclosingElement is GenericTypeAliasElement) { assert(e.enclosingElement.name != ''); - newModelElement = new ModelFunctionTypedef(e, library); + newModelElement = + new ModelFunctionTypedef(e, library, packageGraph); } else { // Allowing null here is allowed as a workaround for // dart-lang/sdk#32005. assert(e.name == '' || e.name == null); - newModelElement = new ModelFunctionAnonymous(e, library); + newModelElement = new ModelFunctionAnonymous(e, packageGraph); } } } if (e is FunctionTypeAliasElement) { - newModelElement = new Typedef(e, library); + newModelElement = new Typedef(e, library, packageGraph); } if (e is FieldElement) { if (enclosingClass == null) { if (e.isEnumConstant) { int index = e.computeConstantValue().getField(e.name).toIntValue(); - newModelElement = - new EnumField.forConstant(index, e, library, getter); + newModelElement = new EnumField.forConstant( + index, e, library, packageGraph, getter); } else if (e.enclosingElement.isEnum) { - newModelElement = new EnumField(e, library, getter, setter); + newModelElement = + new EnumField(e, library, packageGraph, getter, setter); } else { - newModelElement = new Field(e, library, getter, setter); + newModelElement = + new Field(e, library, packageGraph, getter, setter); } } else { // EnumFields can't be inherited, so this case is simpler. - newModelElement = - new Field.inherited(e, enclosingClass, library, getter, setter); + newModelElement = new Field.inherited( + e, enclosingClass, library, packageGraph, getter, setter); } } if (e is ConstructorElement) { - newModelElement = new Constructor(e, library); + newModelElement = new Constructor(e, library, packageGraph); } if (e is MethodElement && e.isOperator) { if (enclosingClass == null) - newModelElement = new Operator(e, library); + newModelElement = new Operator(e, library, packageGraph); else - newModelElement = new Operator.inherited(e, enclosingClass, library, + newModelElement = new Operator.inherited( + e, enclosingClass, library, packageGraph, originalMember: originalMember); } if (e is MethodElement && !e.isOperator) { if (enclosingClass == null) - newModelElement = new Method(e, library); + newModelElement = new Method(e, library, packageGraph); else - newModelElement = new Method.inherited(e, enclosingClass, library, + newModelElement = new Method.inherited( + e, enclosingClass, library, packageGraph, originalMember: originalMember); } if (e is TopLevelVariableElement) { @@ -2646,7 +2666,8 @@ abstract class ModelElement extends Canonicalization ..addAll(library.constants); newModelElement = allVariables.firstWhere((v) => v.element == e); } else { - newModelElement = new TopLevelVariable(e, library, getter, setter); + newModelElement = + new TopLevelVariable(e, library, packageGraph, getter, setter); } } if (e is PropertyAccessorElement) { @@ -2654,21 +2675,22 @@ abstract class ModelElement extends Canonicalization if (e.enclosingElement is ClassElement || e is MultiplyInheritedExecutableElement) { if (enclosingClass == null) - newModelElement = new InheritableAccessor(e, library); + newModelElement = + new InheritableAccessor(e, library, packageGraph); else newModelElement = new InheritableAccessor.inherited( - e, library, enclosingClass, + e, library, packageGraph, enclosingClass, originalMember: originalMember); } else { - newModelElement = new Accessor(e, library, null); + newModelElement = new Accessor(e, library, packageGraph, null); } } if (e is TypeParameterElement) { - newModelElement = new TypeParameter(e, library); + newModelElement = new TypeParameter(e, library, packageGraph); } if (e is ParameterElement) { - newModelElement = - new Parameter(e, library, originalMember: originalMember); + newModelElement = new Parameter(e, library, packageGraph, + originalMember: originalMember); } } } @@ -2814,16 +2836,23 @@ abstract class ModelElement extends Canonicalization GetterSetterCombo thisAsCombo = this as GetterSetterCombo; if (thisAsCombo.hasGetter) { newGetter = new ModelElement.from( - thisAsCombo.getter.element, thisAsCombo.getter.definingLibrary); + thisAsCombo.getter.element, + thisAsCombo.getter.definingLibrary, + thisAsCombo.getter.packageGraph); } if (thisAsCombo.hasSetter) { newSetter = new ModelElement.from( - thisAsCombo.setter.element, thisAsCombo.setter.definingLibrary); + thisAsCombo.setter.element, + thisAsCombo.setter.definingLibrary, + thisAsCombo.setter.packageGraph); } } ModelElement fromThis = new ModelElement.from( - element, thisInheritable.definingEnclosingElement.library, - getter: newGetter, setter: newSetter); + element, + thisInheritable.definingEnclosingElement.library, + thisInheritable.definingEnclosingElement.packageGraph, + getter: newGetter, + setter: newSetter); docFrom = fromThis.documentationFrom; } else { docFrom = [this]; @@ -3188,10 +3217,9 @@ abstract class ModelElement extends Canonicalization return _overriddenDepth; } + final PackageGraph _packageGraph; @override - PackageGraph get packageGraph => (this is Library) - ? (this as Library).packageGraph - : this.library.packageGraph; + PackageGraph get packageGraph => _packageGraph; bool get isPublicAndPackageDocumented => isPublic && library.packageGraph.packageDocumentedFor(this); @@ -3247,7 +3275,7 @@ abstract class ModelElement extends Canonicalization } _parameters = new UnmodifiableListView(params - .map((p) => new ModelElement.from(p, library)) + .map((p) => new ModelElement.from(p, library, packageGraph)) .toList() as Iterable); } return _parameters; @@ -3411,8 +3439,7 @@ abstract class ModelElement extends Canonicalization assert(!name.isEmpty || (this.element is TypeDefiningElement && (this.element as TypeDefiningElement).type.name == "dynamic") || - (this is ModelFunction && - element.enclosingElement is ParameterElement)); + this is ModelFunction); if (href == null) { if (isPublicAndPackageDocumented) { @@ -3438,9 +3465,6 @@ abstract class ModelElement extends Canonicalization if (lib == null) { lib = packageGraph.findOrCreateLibraryFor(e); } - if (lib == null) { - assert(e.kind == ElementKind.DYNAMIC); - } return lib; } @@ -3586,14 +3610,18 @@ abstract class ModelElement extends Canonicalization /// A [ModelElement] for a [FunctionElement] that isn't part of a type definition. class ModelFunction extends ModelFunctionTyped { - ModelFunction(FunctionElement element, Library library) - : super(element, library); + ModelFunction( + FunctionElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph); @override bool get isStatic { return _func.isStatic; } + @override + String get name => element.name ?? ''; + @override FunctionElement get _func => (element as FunctionElement); } @@ -3605,8 +3633,9 @@ class ModelFunction extends ModelFunctionTyped { /// have a name, but we document it as "Function" to match how these are /// written in declarations. class ModelFunctionAnonymous extends ModelFunctionTyped { - ModelFunctionAnonymous(FunctionTypedElement element, Library library) - : super(element, library) {} + ModelFunctionAnonymous( + FunctionTypedElement element, PackageGraph packageGraph) + : super(element, null, packageGraph) {} @override String get name => 'Function'; @@ -3621,8 +3650,9 @@ class ModelFunctionAnonymous extends ModelFunctionTyped { /// A [ModelElement] for a [GenericModelFunctionElement] that is part of an /// explicit typedef. class ModelFunctionTypedef extends ModelFunctionTyped { - ModelFunctionTypedef(FunctionTypedElement element, Library library) - : super(element, library); + ModelFunctionTypedef( + FunctionTypedElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph); @override String get name { @@ -3643,14 +3673,15 @@ class ModelFunctionTyped extends ModelElement @override List typeParameters = []; - ModelFunctionTyped(FunctionTypedElement element, Library library) - : super(element, library, null) { + ModelFunctionTyped( + FunctionTypedElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph, null) { _calcTypeParameters(); } void _calcTypeParameters() { typeParameters = _func.typeParameters.map((f) { - return new ModelElement.from(f, library); + return new ModelElement.from(f, library, packageGraph); }).toList(); } @@ -3715,12 +3746,12 @@ class Operator extends Method { "%": "modulo" }; - Operator(MethodElement element, Library library) : super(element, library); + Operator(MethodElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph); - Operator.inherited( - MethodElement element, Class enclosingClass, Library library, - {Member originalMember}) - : super.inherited(element, enclosingClass, library, + Operator.inherited(MethodElement element, Class enclosingClass, + Library library, PackageGraph packageGraph, {Member originalMember}) + : super.inherited(element, enclosingClass, library, packageGraph, originalMember: originalMember) { _isInherited = true; } @@ -4420,11 +4451,13 @@ class PackageGraph extends Canonicalization with Nameable, Warnable { Accessor getter; Accessor setter; if (e is PropertyInducingElement) { - if (e.getter != null) getter = new ModelElement.from(e.getter, lib); - if (e.setter != null) setter = new ModelElement.from(e.setter, lib); + if (e.getter != null) + getter = new ModelElement.from(e.getter, lib, packageGraph); + if (e.setter != null) + setter = new ModelElement.from(e.setter, lib, packageGraph); } - modelElement = - new ModelElement.from(e, lib, getter: getter, setter: setter); + modelElement = new ModelElement.from(e, lib, packageGraph, + getter: getter, setter: setter); } assert(modelElement is! Inheritable); if (modelElement != null && !modelElement.isCanonical) { @@ -4681,9 +4714,10 @@ class Package extends LibraryContainer implements Comparable, Privacy { } class Parameter extends ModelElement implements EnclosedElement { - Parameter(ParameterElement element, Library library, {Member originalMember}) - : super(element, library, originalMember); - + Parameter( + ParameterElement element, Library library, PackageGraph packageGraph, + {Member originalMember}) + : super(element, library, packageGraph, originalMember); String get defaultValue { if (!hasDefaultValue) return null; return _parameter.defaultValueCode; @@ -4691,7 +4725,7 @@ class Parameter extends ModelElement implements EnclosedElement { @override ModelElement get enclosingElement => - new ModelElement.from(_parameter.enclosingElement, library); + new ModelElement.from(_parameter.enclosingElement, library, packageGraph); bool get hasDefaultValue { return _parameter.defaultValueCode != null && @@ -4855,12 +4889,12 @@ abstract class TypeParameters implements ModelElement { String get genericParameters { if (typeParameters.isEmpty) return ''; - return '<${typeParameters.map((t) => t.name).join(', ')}>'; + return '<${typeParameters.map((t) => t.name).join(', ')}>'; } String get linkedGenericParameters { if (typeParameters.isEmpty) return ''; - return '<${typeParameters.map((t) => t.linkedName).join(', ')}>'; + return '<${typeParameters.map((t) => t.linkedName).join(', ')}>'; } @override @@ -4879,8 +4913,8 @@ class TopLevelVariable extends ModelElement final Accessor setter; TopLevelVariable(TopLevelVariableElement element, Library library, - this.getter, this.setter) - : super(element, library, null) { + PackageGraph packageGraph, this.getter, this.setter) + : super(element, library, packageGraph, null) { if (getter != null) { getter.enclosingCombo = this; assert(getter.enclosingCombo != null); @@ -4954,8 +4988,9 @@ class TopLevelVariable extends ModelElement class Typedef extends ModelElement with SourceCodeMixin, TypeParameters implements EnclosedElement { - Typedef(FunctionTypeAliasElement element, Library library) - : super(element, library, null); + Typedef(FunctionTypeAliasElement element, Library library, + PackageGraph packageGraph) + : super(element, library, packageGraph, null); @override ModelElement get enclosingElement => library; @@ -4969,7 +5004,7 @@ class Typedef extends ModelElement List genericTypeParameters = (element as GenericTypeAliasElement).function.typeParameters; if (genericTypeParameters.isNotEmpty) { - return '<${genericTypeParameters.map((t) => t.name).join(', ')}>'; + return '<${genericTypeParameters.map((t) => t.name).join(', ')}>'; } } // else, all types are resolved. return ''; @@ -4997,17 +5032,18 @@ class Typedef extends ModelElement @override List get typeParameters => _typedef.typeParameters.map((f) { - return new ModelElement.from(f, library); + return new ModelElement.from(f, library, packageGraph); }).toList(); } class TypeParameter extends ModelElement { - TypeParameter(TypeParameterElement element, Library library) - : super(element, library, null); + TypeParameter( + TypeParameterElement element, Library library, PackageGraph packageGraph) + : super(element, library, packageGraph, null); @override ModelElement get enclosingElement => - new ModelElement.from(element.enclosingElement, library); + new ModelElement.from(element.enclosingElement, library, packageGraph); @override String get href { diff --git a/test/model_test.dart b/test/model_test.dart index e4fdef5007..8e2f7243a4 100644 --- a/test/model_test.dart +++ b/test/model_test.dart @@ -835,7 +835,10 @@ void main() { }); test('class name with generics', () { - expect(F.nameWithGenerics, equals('F<T extends String>')); + expect( + F.nameWithGenerics, + equals( + 'F<T extends String>')); }); test('correctly finds all the classes', () { @@ -1062,7 +1065,10 @@ void main() { test("has a (synthetic) values constant", () { var values = animal.constants.firstWhere((f) => f.name == 'values'); expect(values, isNotNull); - expect(values.constantValue, equals('const List<Animal>')); + expect( + values.constantValue, + equals( + 'const List<Animal>')); expect(values.documentation, startsWith('A constant List')); }); @@ -1173,28 +1179,32 @@ void main() { test('function returning FutureOr', () { expect(thisIsFutureOrNull.isAsynchronous, isFalse); - expect(thisIsFutureOrNull.linkedReturnType, - equals('FutureOr<Null>')); + expect( + thisIsFutureOrNull.linkedReturnType, + equals( + 'FutureOr<Null>')); }); test('function returning FutureOr', () { expect(thisIsFutureOrNull.isAsynchronous, isFalse); - expect(thisIsFutureOrT.linkedReturnType, - equals('FutureOr<T>')); + expect( + thisIsFutureOrT.linkedReturnType, + equals( + 'FutureOr<T>')); }); test('function with a parameter having type FutureOr', () { expect( paramOfFutureOrNull.linkedParams(), equals( - 'FutureOr<Null> future')); + 'FutureOr<Null> future')); }); test('function with a bound type to FutureOr', () { expect( typeParamOfFutureOr.linkedGenericParameters, equals( - '<T extends FutureOr<List>>')); + '<T extends FutureOr<List>>')); }); test('docs do not lose brackets in code blocks', () { @@ -1232,7 +1242,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('supports generic methods', () { - expect(genericFunction.nameWithGenerics, 'genericFunction<T>'); + expect(genericFunction.nameWithGenerics, + 'genericFunction<T>'); }); }); @@ -1252,21 +1263,21 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, // TODO(jcollins-g): really, these shouldn't be called "parameters" in // the span class. expect(explicitSetter.linkedReturnType, - 'dynamic Function(int, Cool, List<int>)'); + 'dynamic Function(int, Cool, List<int>)'); }); test('parameterized type from field is correctly displayed', () { Field aField = TemplatedInterface.instanceProperties .singleWhere((f) => f.name == 'aField'); expect(aField.linkedReturnType, - 'AnotherParameterizedClass<Stream<List<int>>>'); + 'AnotherParameterizedClass<Stream<List<int>>>'); }); test('parameterized type from inherited field is correctly displayed', () { Field aInheritedField = TemplatedInterface.inheritedProperties .singleWhere((f) => f.name == 'aInheritedField'); expect(aInheritedField.linkedReturnType, - 'AnotherParameterizedClass<List<int>>'); + 'AnotherParameterizedClass<List<int>>'); }); test( @@ -1276,7 +1287,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .singleWhere((f) => f.name == 'aGetter') .getter; expect(aGetter.linkedReturnType, - 'AnotherParameterizedClass<Map<A, List<String>>>'); + 'AnotherParameterizedClass<Map<A, List<String>>>'); }); test( @@ -1286,7 +1297,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .singleWhere((f) => f.name == 'aInheritedGetter') .getter; expect(aInheritedGetter.linkedReturnType, - 'AnotherParameterizedClass<List<int>>'); + 'AnotherParameterizedClass<List<int>>'); }); test( @@ -1296,11 +1307,11 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .singleWhere((f) => f.name == 'aInheritedSetter') .setter; expect(aInheritedSetter.allParameters.first.modelType.linkedName, - 'AnotherParameterizedClass<List<int>>'); + 'AnotherParameterizedClass<List<int>>'); // TODO(jcollins-g): really, these shouldn't be called "parameters" in // the span class. expect(aInheritedSetter.enclosingCombo.linkedReturnType, - 'AnotherParameterizedClass<List<int>>'); + 'AnotherParameterizedClass<List<int>>'); }); test( @@ -1309,7 +1320,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, Method aMethodInterface = TemplatedInterface.allInstanceMethods .singleWhere((m) => m.name == 'aMethodInterface'); expect(aMethodInterface.linkedReturnType, - 'AnotherParameterizedClass<List<int>>'); + 'AnotherParameterizedClass<List<int>>'); }); test( @@ -1318,7 +1329,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, Method aInheritedMethod = TemplatedInterface.allInstanceMethods .singleWhere((m) => m.name == 'aInheritedMethod'); expect(aInheritedMethod.linkedReturnType, - 'AnotherParameterizedClass<List<int>>'); + 'AnotherParameterizedClass<List<int>>'); }); test( @@ -1328,7 +1339,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .allInstanceMethods .singleWhere((m) => m.name == 'aTypedefReturningMethodInterface'); expect(aTypedefReturningMethodInterface.linkedReturnType, - 'ParameterizedTypedef<List<String>>'); + 'ParameterizedTypedef<List<String>>'); }); test( @@ -1338,7 +1349,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .allInstanceMethods .singleWhere((m) => m.name == 'aInheritedTypedefReturningMethod'); expect(aInheritedTypedefReturningMethod.linkedReturnType, - 'ParameterizedTypedef<List<int>>'); + 'ParameterizedTypedef<List<int>>'); }); test('parameterized types for inherited operator is correctly displayed', @@ -1347,9 +1358,9 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .inheritedOperators .singleWhere((m) => m.name == 'operator +'); expect(aInheritedAdditionOperator.linkedReturnType, - 'ParameterizedClass<List<int>>'); + 'ParameterizedClass<List<int>>'); expect(aInheritedAdditionOperator.linkedParams(), - 'ParameterizedClass<List<int>> other'); + 'ParameterizedClass<List<int>> other'); }); test('', () {}); @@ -1416,7 +1427,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( getAFunctionReturningVoid.linkedReturnType, equals( - 'Function(T1, T2)')); + 'void Function(T1, T2)')); }); test( @@ -1425,7 +1436,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( getAFunctionReturningBool.linkedReturnType, equals( - 'Function<T4>(String, T1, T4)')); + 'bool Function<T4>(String, T1, T4)')); }); test('has a fully qualified name', () { @@ -1499,7 +1510,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, test('parameter has generics in signature', () { expect(testGeneric.parameters[0].modelType.linkedName, - 'Map<String, dynamic>'); + 'Map<String, dynamic>'); }); test('parameter is a function', () { @@ -1508,7 +1519,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('generic method type args are rendered', () { - expect(testGenericMethod.nameWithGenerics, 'testGenericMethod<T>'); + expect(testGenericMethod.nameWithGenerics, + 'testGenericMethod<T>'); }); test('doc for method with no return type', () { @@ -1928,7 +1940,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( fieldWithTypedef.linkedReturnType, equals( - 'ParameterizedTypedef<bool>')); + 'ParameterizedTypedef<bool>')); }); }); @@ -1937,10 +1949,16 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, TopLevelVariable v3, justGetter, justSetter; TopLevelVariable setAndGet, mapWithDynamicKeys; TopLevelVariable nodocGetter, nodocSetter; + TopLevelVariable complicatedReturn; + TopLevelVariable importantComputations; setUp(() { v = exLibrary.properties.firstWhere((p) => p.name == 'number'); v3 = exLibrary.properties.firstWhere((p) => p.name == 'y'); + importantComputations = fakeLibrary.properties + .firstWhere((v) => v.name == 'importantComputations'); + complicatedReturn = fakeLibrary.properties + .firstWhere((f) => f.name == 'complicatedReturn'); nodocGetter = fakeLibrary.properties .firstWhere((p) => p.name == 'getterSetterNodocGetter'); nodocSetter = fakeLibrary.properties @@ -1955,6 +1973,32 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .firstWhere((p) => p.name == 'mapWithDynamicKeys'); }); + test( + 'Verify that a map containing anonymous functions as values works correctly', + () { + Iterable typeArguments = + (importantComputations.modelType.returnType as DefinedElementType) + .typeArguments; + expect(typeArguments, isNotEmpty); + expect( + typeArguments.last.linkedName, + equals( + '(List<num>) → dynamic')); + expect( + importantComputations.linkedReturnType, + equals( + 'Map<int, (List<num>) → dynamic>')); + }); + + test( + 'Verify that a complex type parameter with an anonymous function works correctly', + () { + expect( + complicatedReturn.linkedReturnType, + equals( + 'ATypeTakingClass<String Function(int)>')); + }); + test('@nodoc on simple property works', () { TopLevelVariable nodocSimple = fakeLibrary.publicProperties.firstWhere( (p) => p.name == 'simplePropertyHidden', @@ -2135,9 +2179,9 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, test('displays generic parameters correctly', () { expect(constructorTesterDefault.nameWithGenerics, - 'ConstructorTester<A, B>'); + 'ConstructorTester<A, B>'); expect(constructorTesterFromSomething.nameWithGenerics, - 'ConstructorTester<A, B>.fromSomething'); + 'ConstructorTester<A, B>.fromSomething'); }); test('has a fully qualified name', () { @@ -2190,15 +2234,17 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('a function returning a Future', () { - expect(returningFutureVoid.linkedReturnType, - equals('Future<void>')); + expect( + returningFutureVoid.linkedReturnType, + equals( + 'Future<void>')); }); test('a function requiring a Future parameter', () { expect( aVoidParameter.linkedParams(showMetadata: true, showNames: true), equals( - 'Future<void> p1')); + 'Future<void> p1')); }); test('a class that extends Future', () { @@ -2208,8 +2254,10 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, 'ExtendsFutureVoid')); DefinedElementType FutureVoid = ExtendsFutureVoid.publicSuperChain .firstWhere((c) => c.name == 'Future'); - expect(FutureVoid.linkedName, - equals('Future<void>')); + expect( + FutureVoid.linkedName, + equals( + 'Future<void>')); }); test('a class that implements Future', () { @@ -2219,8 +2267,10 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, 'ImplementsFutureVoid')); DefinedElementType FutureVoid = ImplementsFutureVoid.publicInterfaces .firstWhere((c) => c.name == 'Future'); - expect(FutureVoid.linkedName, - equals('Future<void>')); + expect( + FutureVoid.linkedName, + equals( + 'Future<void>')); }); test('Verify that a mixin with a void type parameter works', () { @@ -2233,7 +2283,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( ATypeTakingClassVoid.linkedName, equals( - 'ATypeTakingClass<void>')); + 'ATypeTakingClass<void>')); }); }); @@ -2262,6 +2312,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, t = exLibrary.typedefs.firstWhere((t) => t.name == 'processMessage'); generic = fakeLibrary.typedefs.firstWhere((t) => t.name == 'NewGenericTypedef'); + aComplexTypedef = exLibrary.typedefs.firstWhere((t) => t.name == 'aComplexTypedef'); TypedefUsingClass = @@ -2275,14 +2326,16 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( theConstructor.linkedParams(), equals( - 'ParameterizedTypedef<double> x')); + 'ParameterizedTypedef<double> x')); }); test('anonymous nested functions inside typedefs are handled', () { expect(aComplexTypedef, isNotNull); - expect(aComplexTypedef.linkedReturnType, startsWith('Function')); - expect(aComplexTypedef.nameWithGenerics, - equals('aComplexTypedef<A1, A2, A3>')); + expect(aComplexTypedef.linkedReturnType, startsWith('void Function')); + expect( + aComplexTypedef.nameWithGenerics, + equals( + 'aComplexTypedef<A1, A2, A3>')); }); test('anonymous nested functions inside typedefs are handled correctly', @@ -2290,7 +2343,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( aComplexTypedef.linkedReturnType, equals( - 'Function(A1, A2, A3)')); + 'void Function(A1, A2, A3)')); expect( aComplexTypedef.linkedParamsLines, equals( @@ -2315,18 +2368,27 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, test('linked return type', () { expect(t.linkedReturnType, equals('String')); - expect(generic.linkedReturnType, - equals('List<S>')); + expect( + generic.linkedReturnType, + equals( + 'List<S>')); }); test("name with generics", () { - expect(t.nameWithGenerics, equals('processMessage<T>')); - expect(generic.nameWithGenerics, equals('NewGenericTypedef<T>')); + expect( + t.nameWithGenerics, + equals( + 'processMessage<T>')); + expect( + generic.nameWithGenerics, + equals( + 'NewGenericTypedef<T>')); }); test("generic parameters", () { expect(t.genericParameters, equals('')); - expect(generic.genericParameters, equals('<S>')); + expect(generic.genericParameters, + equals('<S>')); }); }); diff --git a/testing/test_package/lib/fake.dart b/testing/test_package/lib/fake.dart index ff77405f39..d7c79eab6b 100644 --- a/testing/test_package/lib/fake.dart +++ b/testing/test_package/lib/fake.dart @@ -177,6 +177,14 @@ class AClassWithFancyProperties { const _APrivateConstClass CUSTOM_CLASS_PRIVATE = const _APrivateConstClass(); +/// Type inference mixing with anonymous functions. +final importantComputations = { + 1: (List a) => a[0] + a[1], + 2: (List a) => a[0] - a[1], + 3: (List a) => a[0] * a[1], + 4: (List a) => -a[0] +}; + // No dart docs on purpose. Also, a non-primitive const class. const ConstantClass CUSTOM_CLASS = const ConstantClass('custom'); @@ -213,6 +221,9 @@ typedef T GenericTypedef(T input); /// A typedef with the new style generic function syntax. typedef NewGenericTypedef = List Function(T, int, bool); +/// A complicated type parameter to ATypeTakingClass. +ATypeTakingClass get complicatedReturn => null; + /// Lots and lots of parameters. typedef int LotsAndLotsOfParameters(so, many, parameters, it, should, wrap, when, converted, to, html, documentation); diff --git a/testing/test_package_docs/ex/Animal-class.html b/testing/test_package_docs/ex/Animal-class.html index 0cda6e486e..a58ab32dae 100644 --- a/testing/test_package_docs/ex/Animal-class.html +++ b/testing/test_package_docs/ex/Animal-class.html @@ -155,13 +155,13 @@

Constants

values - → const List<Animal> + → const List<Animal>

A constant List of the values in this enum, in order of their declaration.

- const List<Animal> + const List<Animal>
diff --git a/testing/test_package_docs/ex/AnotherParameterizedClass-class.html b/testing/test_package_docs/ex/AnotherParameterizedClass-class.html index 79bfd63f9a..2df64ea5dd 100644 --- a/testing/test_package_docs/ex/AnotherParameterizedClass-class.html +++ b/testing/test_package_docs/ex/AnotherParameterizedClass-class.html @@ -25,7 +25,7 @@
AnotherParameterizedClass
-

myGenericFunction<S> function

+

myGenericFunction<S> function

void myGenericFunction -<S>(int a, bool b, S c) +<S>(int a, bool b, S c)

A generic function with a type parameter.

diff --git a/testing/test_package_docs/fake/myMap-constant.html b/testing/test_package_docs/fake/myMap-constant.html index d0453ae658..f48a4591a0 100644 --- a/testing/test_package_docs/fake/myMap-constant.html +++ b/testing/test_package_docs/fake/myMap-constant.html @@ -101,9 +101,11 @@
fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/onlyPositionalWithNoDefaultNoType.html b/testing/test_package_docs/fake/onlyPositionalWithNoDefaultNoType.html index 3ce2bab0f0..250d34f88f 100644 --- a/testing/test_package_docs/fake/onlyPositionalWithNoDefaultNoType.html +++ b/testing/test_package_docs/fake/onlyPositionalWithNoDefaultNoType.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/paintImage1.html b/testing/test_package_docs/fake/paintImage1.html index a00b47c6bf..d8a01c9abe 100644 --- a/testing/test_package_docs/fake/paintImage1.html +++ b/testing/test_package_docs/fake/paintImage1.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/paintImage2.html b/testing/test_package_docs/fake/paintImage2.html index dcd77054a2..e3010efa4f 100644 --- a/testing/test_package_docs/fake/paintImage2.html +++ b/testing/test_package_docs/fake/paintImage2.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/paramFromAnotherLib.html b/testing/test_package_docs/fake/paramFromAnotherLib.html index 13d6c4fce3..57b8824714 100644 --- a/testing/test_package_docs/fake/paramFromAnotherLib.html +++ b/testing/test_package_docs/fake/paramFromAnotherLib.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/paramOfFutureOrNull.html b/testing/test_package_docs/fake/paramOfFutureOrNull.html index 3a68ca5f29..e94e76755c 100644 --- a/testing/test_package_docs/fake/paramOfFutureOrNull.html +++ b/testing/test_package_docs/fake/paramOfFutureOrNull.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • @@ -157,7 +159,7 @@

    paramOfFutureOrNull function

    void paramOfFutureOrNull -(FutureOr<Null> future) +(FutureOr<Null> future)

    Has a parameter explicitly typed FutureOr<Null>.

    diff --git a/testing/test_package_docs/fake/required-constant.html b/testing/test_package_docs/fake/required-constant.html index 39813d9373..8c9c1cc26b 100644 --- a/testing/test_package_docs/fake/required-constant.html +++ b/testing/test_package_docs/fake/required-constant.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/returningFutureVoid.html b/testing/test_package_docs/fake/returningFutureVoid.html index 426a39ebd7..ff6efd6d88 100644 --- a/testing/test_package_docs/fake/returningFutureVoid.html +++ b/testing/test_package_docs/fake/returningFutureVoid.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • @@ -155,7 +157,7 @@
    fake library

    returningFutureVoid function

    - Future<void> + Future<void> returningFutureVoid ()
    diff --git a/testing/test_package_docs/fake/setAndGet.html b/testing/test_package_docs/fake/setAndGet.html index 28b51b2087..bedaf73791 100644 --- a/testing/test_package_docs/fake/setAndGet.html +++ b/testing/test_package_docs/fake/setAndGet.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/short.html b/testing/test_package_docs/fake/short.html index c4b72471d1..d2f9b44470 100644 --- a/testing/test_package_docs/fake/short.html +++ b/testing/test_package_docs/fake/short.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/simpleProperty.html b/testing/test_package_docs/fake/simpleProperty.html index bbd6541281..2f6b1c904c 100644 --- a/testing/test_package_docs/fake/simpleProperty.html +++ b/testing/test_package_docs/fake/simpleProperty.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/soIntense.html b/testing/test_package_docs/fake/soIntense.html index f2f24ed6e4..7abe907b4f 100644 --- a/testing/test_package_docs/fake/soIntense.html +++ b/testing/test_package_docs/fake/soIntense.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/testingCodeSyntaxInOneLiners-constant.html b/testing/test_package_docs/fake/testingCodeSyntaxInOneLiners-constant.html index 4d4cece011..02d5243084 100644 --- a/testing/test_package_docs/fake/testingCodeSyntaxInOneLiners-constant.html +++ b/testing/test_package_docs/fake/testingCodeSyntaxInOneLiners-constant.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/thisIsAlsoAsync.html b/testing/test_package_docs/fake/thisIsAlsoAsync.html index 84fa861a04..4ed794d5ea 100644 --- a/testing/test_package_docs/fake/thisIsAlsoAsync.html +++ b/testing/test_package_docs/fake/thisIsAlsoAsync.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/thisIsAsync.html b/testing/test_package_docs/fake/thisIsAsync.html index 4080a53395..c297c1f884 100644 --- a/testing/test_package_docs/fake/thisIsAsync.html +++ b/testing/test_package_docs/fake/thisIsAsync.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/thisIsFutureOr.html b/testing/test_package_docs/fake/thisIsFutureOr.html index f731b26057..e53aa69965 100644 --- a/testing/test_package_docs/fake/thisIsFutureOr.html +++ b/testing/test_package_docs/fake/thisIsFutureOr.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/thisIsFutureOrNull.html b/testing/test_package_docs/fake/thisIsFutureOrNull.html index 7a5a48a6c8..505cfb603e 100644 --- a/testing/test_package_docs/fake/thisIsFutureOrNull.html +++ b/testing/test_package_docs/fake/thisIsFutureOrNull.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • @@ -155,7 +157,7 @@
    fake library

    thisIsFutureOrNull function

    - FutureOr<Null> + FutureOr<Null> thisIsFutureOrNull ()
    diff --git a/testing/test_package_docs/fake/thisIsFutureOrT.html b/testing/test_package_docs/fake/thisIsFutureOrT.html index 0a2cf17e79..f0f618f8f6 100644 --- a/testing/test_package_docs/fake/thisIsFutureOrT.html +++ b/testing/test_package_docs/fake/thisIsFutureOrT.html @@ -25,7 +25,7 @@
    thisIsFutureOrT
    @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • @@ -152,12 +154,12 @@
    fake library
    -

    thisIsFutureOrT<T> function

    +

    thisIsFutureOrT<T> function

    - FutureOr<T> + FutureOr<T> thisIsFutureOrT -<T>() +<T>()

    Explicitly return a FutureOr<T>.

    diff --git a/testing/test_package_docs/fake/topLevelFunction.html b/testing/test_package_docs/fake/topLevelFunction.html index bd52e9d2de..d453033429 100644 --- a/testing/test_package_docs/fake/topLevelFunction.html +++ b/testing/test_package_docs/fake/topLevelFunction.html @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • diff --git a/testing/test_package_docs/fake/typeParamOfFutureOr.html b/testing/test_package_docs/fake/typeParamOfFutureOr.html index b40d99ae17..39858ebcaf 100644 --- a/testing/test_package_docs/fake/typeParamOfFutureOr.html +++ b/testing/test_package_docs/fake/typeParamOfFutureOr.html @@ -25,7 +25,7 @@
    typeParamOfFutureOr
    @@ -101,9 +101,11 @@
    fake library
  • Properties
  • aCoolVariable
  • +
  • complicatedReturn
  • dynamicGetter
  • getterSetterNodocGetter
  • getterSetterNodocSetter
  • +
  • importantComputations
  • justGetter
  • justSetter
  • mapWithDynamicKeys
  • @@ -152,12 +154,12 @@
    fake library
    -

    typeParamOfFutureOr<T extends FutureOr<List>> function

    +

    typeParamOfFutureOr<T extends FutureOr<List>> function

    void typeParamOfFutureOr -<T extends FutureOr<List>>() +<T extends FutureOr<List>>()

    Has a type parameter bound to FutureOr<List>.

    diff --git a/testing/test_package_docs/index.json b/testing/test_package_docs/index.json index 6bf07d553e..8fce2a5e33 100644 --- a/testing/test_package_docs/index.json +++ b/testing/test_package_docs/index.json @@ -8181,6 +8181,17 @@ "type": "library" } }, + { + "name": "complicatedReturn", + "qualifiedName": "fake.complicatedReturn", + "href": "fake/complicatedReturn.html", + "type": "top-level property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "fake", + "type": "library" + } + }, { "name": "dynamicGetter", "qualifiedName": "fake.dynamicGetter", @@ -8247,6 +8258,17 @@ "type": "library" } }, + { + "name": "importantComputations", + "qualifiedName": "fake.importantComputations", + "href": "fake/importantComputations.html", + "type": "top-level property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "fake", + "type": "library" + } + }, { "name": "incorrectDocReference", "qualifiedName": "fake.incorrectDocReference", diff --git a/testing/test_package_docs/static-assets/styles.css b/testing/test_package_docs/static-assets/styles.css index 56648e9fec..ffedb90d4f 100644 --- a/testing/test_package_docs/static-assets/styles.css +++ b/testing/test_package_docs/static-assets/styles.css @@ -359,6 +359,15 @@ dl dt.callable .name { white-space: nowrap; } +.type-parameter { + white-space: nowrap; +} + +.multi-line-signature .type-parameter .parameter { + margin-left: 0px; + display: unset; +} + .signature { color: #727272; } diff --git a/testing/test_package_docs/test_package_imported.main/Whataclass-class.html b/testing/test_package_docs/test_package_imported.main/Whataclass-class.html index 1910f7f506..376eabc9f4 100644 --- a/testing/test_package_docs/test_package_imported.main/Whataclass-class.html +++ b/testing/test_package_docs/test_package_imported.main/Whataclass-class.html @@ -25,7 +25,7 @@
    Whataclass
    @@ -51,7 +51,7 @@
    test_package_imported.main library
    -

    Whataclass<T> class

    +

    Whataclass<T> class

    Some docs for whataclass

    diff --git a/testing/test_package_docs/test_package_imported.main/Whataclass/Whataclass.html b/testing/test_package_docs/test_package_imported.main/Whataclass/Whataclass.html index d574bb0b13..4e5d3c1b5d 100644 --- a/testing/test_package_docs/test_package_imported.main/Whataclass/Whataclass.html +++ b/testing/test_package_docs/test_package_imported.main/Whataclass/Whataclass.html @@ -25,7 +25,7 @@
    Whataclass
    @@ -61,11 +61,11 @@
    Whataclass class
    -

    Whataclass<T> constructor

    +

    Whataclass<T> constructor

    - Whataclass<T>() + Whataclass<T>()
    diff --git a/testing/test_package_docs/test_package_imported.main/Whataclass/hashCode.html b/testing/test_package_docs/test_package_imported.main/Whataclass/hashCode.html index f015412839..9d5ac579ee 100644 --- a/testing/test_package_docs/test_package_imported.main/Whataclass/hashCode.html +++ b/testing/test_package_docs/test_package_imported.main/Whataclass/hashCode.html @@ -25,7 +25,7 @@
    hashCode
    diff --git a/testing/test_package_docs/test_package_imported.main/Whataclass/noSuchMethod.html b/testing/test_package_docs/test_package_imported.main/Whataclass/noSuchMethod.html index 96f77fa44a..e26ddd0e2e 100644 --- a/testing/test_package_docs/test_package_imported.main/Whataclass/noSuchMethod.html +++ b/testing/test_package_docs/test_package_imported.main/Whataclass/noSuchMethod.html @@ -25,7 +25,7 @@
    noSuchMethod
    diff --git a/testing/test_package_docs/test_package_imported.main/Whataclass/operator_equals.html b/testing/test_package_docs/test_package_imported.main/Whataclass/operator_equals.html index 9b863eb68a..336e9097fe 100644 --- a/testing/test_package_docs/test_package_imported.main/Whataclass/operator_equals.html +++ b/testing/test_package_docs/test_package_imported.main/Whataclass/operator_equals.html @@ -25,7 +25,7 @@
    operator ==
    diff --git a/testing/test_package_docs/test_package_imported.main/Whataclass/runtimeType.html b/testing/test_package_docs/test_package_imported.main/Whataclass/runtimeType.html index 5ebac74e09..1a66a5bf11 100644 --- a/testing/test_package_docs/test_package_imported.main/Whataclass/runtimeType.html +++ b/testing/test_package_docs/test_package_imported.main/Whataclass/runtimeType.html @@ -25,7 +25,7 @@
    runtimeType
    diff --git a/testing/test_package_docs/test_package_imported.main/Whataclass/toString.html b/testing/test_package_docs/test_package_imported.main/Whataclass/toString.html index c94e83964f..2172963d6e 100644 --- a/testing/test_package_docs/test_package_imported.main/Whataclass/toString.html +++ b/testing/test_package_docs/test_package_imported.main/Whataclass/toString.html @@ -25,7 +25,7 @@
    toString
    diff --git a/testing/test_package_docs/test_package_imported.main/test_package_imported.main-library.html b/testing/test_package_docs/test_package_imported.main/test_package_imported.main-library.html index f83b769685..de4d5e4b2f 100644 --- a/testing/test_package_docs/test_package_imported.main/test_package_imported.main-library.html +++ b/testing/test_package_docs/test_package_imported.main/test_package_imported.main-library.html @@ -66,7 +66,7 @@

    Classes

    - Whataclass<T> + Whataclass<T>
    Some docs for whataclass