From 045adb54dd805dd46c546504c54ccf0224f0e15c Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Wed, 4 Oct 2017 08:19:53 -0700 Subject: [PATCH 1/5] tests working at head --- lib/src/element_type.dart | 28 +++++++++++++------ lib/src/model.dart | 23 ++++++++++----- .../TypedFunctionsWithoutTypedefs-class.html | 2 +- .../getAComplexTypedef.html | 2 +- testing/test_package_docs/index.json | 4 +-- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index c2bee91dc0..ef8d9cff6d 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -13,9 +13,12 @@ import 'model.dart'; class ElementType { final DartType _type; final ModelElement element; + ElementType _returningFrom; String _linkedName; - ElementType(this._type, this.element); + ElementType(this._type, this.element, {ElementType returningFrom = null}) { + _returningFrom = returningFrom; + } bool get isDynamic => _type.isDynamic; @@ -52,6 +55,8 @@ class ElementType { } } _linkedName = buf.toString(); + if (_linkedName.contains('ex/ParameterizedTypedef.html') && _linkedName.contains('>ParameterizedTypedef<')) + 1+1; } return _linkedName; } @@ -76,17 +81,22 @@ class ElementType { List get typeArguments { var type = _type; + if (element.element.enclosingElement.name == 'getAFunctionReturningVoid') { + 1+1; + } if (type is FunctionType) { Iterable typeArguments; - if (type.element is FunctionTypeAliasElement && - type.typeFormals.isEmpty) { - // TODO(jmesserly): simplify check above; we should have a way - // to find instantiated typedefs without consulting the element. - // Also, it will not work if we support typedefs declared inside classes. + if (element is! ModelFunctionAnonymous && type.typeFormals.isEmpty) { + // TODO(jcollins-g): replace with if (FunctionType.isInstantiated) once + // that's reliable and revealed through the interface. typeArguments = type.typeArguments; } else { typeArguments = type.typeFormals.map((f) => f.type); } + if (type.element is FunctionTypeAliasElement && + type.element.name == '') { + 1+1; + } return typeArguments.map(_getElementTypeFrom).toList(); } else { return (_type as ParameterizedType) @@ -100,9 +110,9 @@ class ElementType { var rt = _returnTypeCore; Library lib = element.package.findLibraryFor(rt.element); if (lib == null) { - lib = new Library(rt.element.library, element.package); + lib = new ModelElement.from(rt.element.library, element.library); } - return new ElementType(rt, new ModelElement.from(rt.element, lib)); + return new ElementType(rt, new ModelElement.from(rt.element, lib), returningFrom: this); } DartType get _returnTypeCore => (_type as FunctionType).returnType; @@ -110,6 +120,8 @@ class ElementType { String get _returnTypeName => _returnTypeCore.name; String createLinkedReturnTypeName() { + if (element.name == 'getAFunctionReturningVoid') + 1+1; if (_returnTypeCore.element == null || _returnTypeCore.element.library == null) { if (_returnTypeName != null) { diff --git a/lib/src/model.dart b/lib/src/model.dart index 76a595bcb4..2e282b46d2 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -2221,8 +2221,13 @@ abstract class ModelElement extends Nameable assert(e.name != ''); newModelElement = new ModelFunctionTypedef(e, library); } else { - assert(e.name == ''); - newModelElement = new ModelFunctionAnonymous(e, library); + if (e.enclosingElement is GenericTypeAliasElement) { + assert(e.enclosingElement.name != ''); + newModelElement = new ModelFunctionTypedef(e, library); + } else { + assert(e.name == ''); + newModelElement = new ModelFunctionAnonymous(e, library); + } } } if (e is FunctionTypeAliasElement) { @@ -2902,7 +2907,8 @@ abstract class ModelElement extends Nameable } if (param.modelType.isFunctionType) { var returnTypeName; - bool isTypedef = param.modelType.element is Typedef; + bool isTypedef = (param.modelType.element is Typedef || + param.modelType.element is ModelFunctionTypedef); if (isTypedef) { returnTypeName = param.modelType.linkedName; } else { @@ -3220,8 +3226,7 @@ class ModelFunction extends ModelFunctionTyped { @override String get name { - if (element.enclosingElement is ParameterElement && super.name.isEmpty) - return element.enclosingElement.name; + assert (!super.name.isEmpty); return super.name; } @@ -3250,13 +3255,17 @@ class ModelFunctionAnonymous extends ModelFunctionTyped { /// explicit typedef. class ModelFunctionTypedef extends ModelFunctionTyped { ModelFunctionTypedef(FunctionTypedElement element, Library library) - : super(element, library) {} + : super(element, library) { + if (element.name == '' && element.enclosingElement is GenericTypeAliasElement) { + 1+1; + } + } @override String get name { Element e = element; while (e != null) { - if (e is FunctionTypeAliasElement) return e.name; + if (e is FunctionTypeAliasElement || e is GenericTypeAliasElement) return e.name; e = e.enclosingElement; } assert(false); diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html index 69c464a3e5..2b27898b99 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html @@ -148,7 +148,7 @@

Methods

getAComplexTypedef<A4, A5, A6>() - → Function(A3 A3) + aComplexTypedef
diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html index d0e11e4f51..047d2a107d 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html @@ -64,7 +64,7 @@
class TypedFunctionsWithoutTypedefs
- Function(A3 A3) + aComplexTypedef getAComplexTypedef<A4, A5, A6>()
diff --git a/testing/test_package_docs/index.json b/testing/test_package_docs/index.json index 6a4afcd845..f572201b9f 100644 --- a/testing/test_package_docs/index.json +++ b/testing/test_package_docs/index.json @@ -5491,7 +5491,7 @@ "qualifiedName": "fake.SpecialList.[]", "href": "fake/SpecialList/operator_get.html", "type": "method", - "overriddenDepth": 0, + "overriddenDepth": 1, "enclosedBy": { "name": "SpecialList", "type": "class" @@ -5502,7 +5502,7 @@ "qualifiedName": "fake.SpecialList.[]=", "href": "fake/SpecialList/operator_put.html", "type": "method", - "overriddenDepth": 0, + "overriddenDepth": 1, "enclosedBy": { "name": "SpecialList", "type": "class" From af09030859a1d3de147d2e4bc11d64bdba938470 Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Wed, 4 Oct 2017 08:55:38 -0700 Subject: [PATCH 2/5] Works on mainline analyzer --- lib/src/element_type.dart | 2 -- pubspec.yaml | 2 +- testing/test_package_docs/index.json | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index ef8d9cff6d..0f3e00c651 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -120,8 +120,6 @@ class ElementType { String get _returnTypeName => _returnTypeCore.name; String createLinkedReturnTypeName() { - if (element.name == 'getAFunctionReturningVoid') - 1+1; if (_returnTypeCore.element == null || _returnTypeCore.element.library == null) { if (_returnTypeName != null) { diff --git a/pubspec.yaml b/pubspec.yaml index 826af267ab..7a84a4b547 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,6 +28,6 @@ dev_dependencies: http: ^0.11.0 meta: ^1.0.0 pub_semver: ^1.0.0 - test: '^0.12.20+24' + test: '^0.12.24' executables: dartdoc: null diff --git a/testing/test_package_docs/index.json b/testing/test_package_docs/index.json index f572201b9f..6a4afcd845 100644 --- a/testing/test_package_docs/index.json +++ b/testing/test_package_docs/index.json @@ -5491,7 +5491,7 @@ "qualifiedName": "fake.SpecialList.[]", "href": "fake/SpecialList/operator_get.html", "type": "method", - "overriddenDepth": 1, + "overriddenDepth": 0, "enclosedBy": { "name": "SpecialList", "type": "class" @@ -5502,7 +5502,7 @@ "qualifiedName": "fake.SpecialList.[]=", "href": "fake/SpecialList/operator_put.html", "type": "method", - "overriddenDepth": 1, + "overriddenDepth": 0, "enclosedBy": { "name": "SpecialList", "type": "class" From 2943d4f3fd2dfc0d8e7903f3f4fe9a0b66e7cd2b Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Wed, 4 Oct 2017 09:36:28 -0700 Subject: [PATCH 3/5] New test --- lib/src/element_type.dart | 17 +++++------------ test/model_test.dart | 12 +++++++++++- testing/test_package/lib/example.dart | 4 ++++ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index 0f3e00c651..9b553e453d 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -13,12 +13,9 @@ import 'model.dart'; class ElementType { final DartType _type; final ModelElement element; - ElementType _returningFrom; String _linkedName; - ElementType(this._type, this.element, {ElementType returningFrom = null}) { - _returningFrom = returningFrom; - } + ElementType(this._type, this.element); bool get isDynamic => _type.isDynamic; @@ -72,10 +69,7 @@ class ElementType { if (e == null || e.library == null) { return null; } - Library lib = element.package.findLibraryFor(e); - if (lib == null) { - lib = new Library(e.library, element.package); - } + Library lib = new ModelElement.from(e.library, element.library); return (new ModelElement.from(e, lib)); } @@ -112,7 +106,7 @@ class ElementType { if (lib == null) { lib = new ModelElement.from(rt.element.library, element.library); } - return new ElementType(rt, new ModelElement.from(rt.element, lib), returningFrom: this); + return new ElementType(rt, new ModelElement.from(rt.element, lib)); } DartType get _returnTypeCore => (_type as FunctionType).returnType; @@ -142,9 +136,8 @@ class ElementType { ElementType _getElementTypeFrom(DartType f) { Library lib; // can happen if element is dynamic - lib = element.package.findLibraryFor(f.element); - if (lib == null && f.element.library != null) { - lib = new Library(f.element.library, element.package); + if (f.element.library != null) { + lib = new ModelElement.from(f.element.library, element.library); } return new ElementType(f, new ModelElement.from(f.element, lib)); } diff --git a/test/model_test.dart b/test/model_test.dart index a871805cef..decac3ab51 100644 --- a/test/model_test.dart +++ b/test/model_test.dart @@ -1030,7 +1030,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, Class classB, klass, HasGenerics, Cat, CatString, TypedFunctionsWithoutTypedefs; Method m1, isGreaterThan, m4, m5, m6, m7, convertToMap, abstractMethod; Method inheritedClear, testGeneric, testGenericMethod; - Method getAFunctionReturningVoid; + Method getAFunctionReturningVoid, getAFunctionReturningBool; setUp(() { klass = exLibrary.classes.singleWhere((c) => c.name == 'Klass'); @@ -1064,6 +1064,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, .singleWhere((m) => m.name == 'convertToMap'); TypedFunctionsWithoutTypedefs = exLibrary.classes.singleWhere((c) => c.name == 'TypedFunctionsWithoutTypedefs'); getAFunctionReturningVoid = TypedFunctionsWithoutTypedefs.instanceMethods.singleWhere((m) => m.name == 'getAFunctionReturningVoid'); + getAFunctionReturningBool = TypedFunctionsWithoutTypedefs.instanceMethods.singleWhere((m) => m.name == 'getAFunctionReturningBool'); }); tearDown(() { @@ -1082,6 +1083,15 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect(getAFunctionReturningVoid.linkedReturnType, equals('Function(T1 T2)')); }, skip: 'blocked on https://github.com/dart-lang/sdk/issues/30146'); + test('verify type parameters to anonymous functions are distinct from normal parameters and instantiated type parameters from method', () { + var matcher = new RegExp('Function<T4>\\(String [^<]* [^<]*\\)'); + expect(matcher.hasMatch(getAFunctionReturningBool.linkedReturnType), isTrue); + }); + + test('verify type parameters to anonymous functions are distinct from normal parameters and instantiated type parameters from method, displayed correctly', () { + expect(getAFunctionReturningBool.linkedReturnType, equals('Function<T4>(String T1 T4)')); + }, skip: 'blocked on https://github.com/dart-lang/sdk/issues/30146'); + test('has a fully qualified name', () { expect(m1.fullyQualifiedName, 'ex.B.m1'); }); diff --git a/testing/test_package/lib/example.dart b/testing/test_package/lib/example.dart index fd107e5d9d..3605a17515 100644 --- a/testing/test_package/lib/example.dart +++ b/testing/test_package/lib/example.dart @@ -434,6 +434,10 @@ abstract class TypedFunctionsWithoutTypedefs { void Function(T1, T2) getAFunctionReturningVoid( void callback(T1 argument1, T2 argument2)); + /// This helps us make sure we get both the empty and the non-empty + /// case right for anonymous functions. + bool Function(String, T1, T4) getAFunctionReturningBool(); + /// Returns a complex typedef that includes some anonymous typed functions. aComplexTypedef getAComplexTypedef(); } \ No newline at end of file From 0921ef288e5469314dea11294a5e391a431f0e20 Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Wed, 4 Oct 2017 10:00:44 -0700 Subject: [PATCH 4/5] Cleanups --- lib/src/element_type.dart | 9 -- lib/src/model.dart | 12 +- .../TypedFunctionsWithoutTypedefs-class.html | 11 ++ .../TypedFunctionsWithoutTypedefs.html | 1 + .../getAComplexTypedef.html | 1 + .../getAFunctionReturningBool.html | 106 ++++++++++++++++++ .../getAFunctionReturningVoid.html | 1 + .../hashCode.html | 1 + .../noSuchMethod.html | 1 + .../operator_equals.html | 1 + .../runtimeType.html | 1 + .../toString.html | 1 + testing/test_package_docs/index.json | 11 ++ 13 files changed, 137 insertions(+), 20 deletions(-) create mode 100644 testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningBool.html diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index 9b553e453d..f9ee455aea 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -52,8 +52,6 @@ class ElementType { } } _linkedName = buf.toString(); - if (_linkedName.contains('ex/ParameterizedTypedef.html') && _linkedName.contains('>ParameterizedTypedef<')) - 1+1; } return _linkedName; } @@ -75,9 +73,6 @@ class ElementType { List get typeArguments { var type = _type; - if (element.element.enclosingElement.name == 'getAFunctionReturningVoid') { - 1+1; - } if (type is FunctionType) { Iterable typeArguments; if (element is! ModelFunctionAnonymous && type.typeFormals.isEmpty) { @@ -87,10 +82,6 @@ class ElementType { } else { typeArguments = type.typeFormals.map((f) => f.type); } - if (type.element is FunctionTypeAliasElement && - type.element.name == '') { - 1+1; - } return typeArguments.map(_getElementTypeFrom).toList(); } else { return (_type as ParameterizedType) diff --git a/lib/src/model.dart b/lib/src/model.dart index 2e282b46d2..5cbf310566 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -3224,12 +3224,6 @@ class ModelFunction extends ModelFunctionTyped { return _func.isStatic; } - @override - String get name { - assert (!super.name.isEmpty); - return super.name; - } - @override FunctionElement get _func => (element as FunctionElement); } @@ -3255,11 +3249,7 @@ class ModelFunctionAnonymous extends ModelFunctionTyped { /// explicit typedef. class ModelFunctionTypedef extends ModelFunctionTyped { ModelFunctionTypedef(FunctionTypedElement element, Library library) - : super(element, library) { - if (element.name == '' && element.enclosingElement is GenericTypeAliasElement) { - 1+1; - } - } + : super(element, library); @override String get name { diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html index 2b27898b99..4eee53f254 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs-class.html @@ -154,6 +154,16 @@

Methods

Returns a complex typedef that includes some anonymous typed functions. +
+
+ getAFunctionReturningBool<T1, T2, T3>() + → Function<T4>(String String String) + +
+
+ This helps us make sure we get both the empty and the non-empty +case right for anonymous functions. +
getAFunctionReturningVoid<T1, T2>(void callback(T1 argument1, T2 argument2)) @@ -219,6 +229,7 @@
class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/TypedFunctionsWithoutTypedefs.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/TypedFunctionsWithoutTypedefs.html index 81cdb960a7..3e7c0f4b3c 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/TypedFunctionsWithoutTypedefs.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/TypedFunctionsWithoutTypedefs.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html index 047d2a107d..ce46e09b90 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAComplexTypedef.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningBool.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningBool.html new file mode 100644 index 0000000000..e39aa85055 --- /dev/null +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningBool.html @@ -0,0 +1,106 @@ + + + + + + + + getAFunctionReturningBool method - TypedFunctionsWithoutTypedefs class - ex library - Dart API + + + + + + + + + + + + +
    + +
    + + +
    getAFunctionReturningBool
    + +
    + +
    + + + +
    +
    + Function<T4>(String String String) + getAFunctionReturningBool<T1, T2, T3>() +
    +
    +

    This helps us make sure we get both the empty and the non-empty +case right for anonymous functions.

    +
    + + + +
    + + + +
    + +
    + + test_package 0.0.1 + + • + + cc license + + +
    + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningVoid.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningVoid.html index 209bd83047..7a55b9b073 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningVoid.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningVoid.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/hashCode.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/hashCode.html index d6e5f193c2..b510d45b0e 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/hashCode.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/hashCode.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/noSuchMethod.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/noSuchMethod.html index 066eb75c3d..785a97c02b 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/noSuchMethod.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/noSuchMethod.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/operator_equals.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/operator_equals.html index e515e6d5c6..e7e961854c 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/operator_equals.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/operator_equals.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/runtimeType.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/runtimeType.html index 396376fbf4..527241a8d9 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/runtimeType.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/runtimeType.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/toString.html b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/toString.html index 3323be9ccc..d0dfa37113 100644 --- a/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/toString.html +++ b/testing/test_package_docs/ex/TypedFunctionsWithoutTypedefs/toString.html @@ -50,6 +50,7 @@
    class TypedFunctionsWithoutTypedefs
  • Methods
  • getAComplexTypedef
  • +
  • getAFunctionReturningBool
  • getAFunctionReturningVoid
  • noSuchMethod
  • toString
  • diff --git a/testing/test_package_docs/index.json b/testing/test_package_docs/index.json index 6a4afcd845..f0aa63a07a 100644 --- a/testing/test_package_docs/index.json +++ b/testing/test_package_docs/index.json @@ -2751,6 +2751,17 @@ "type": "class" } }, + { + "name": "getAFunctionReturningBool", + "qualifiedName": "ex.TypedFunctionsWithoutTypedefs.getAFunctionReturningBool", + "href": "ex/TypedFunctionsWithoutTypedefs/getAFunctionReturningBool.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TypedFunctionsWithoutTypedefs", + "type": "class" + } + }, { "name": "getAFunctionReturningVoid", "qualifiedName": "ex.TypedFunctionsWithoutTypedefs.getAFunctionReturningVoid", From e4f4a89d4cde5336160e76983195b23ee6a71a23 Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Wed, 4 Oct 2017 10:01:32 -0700 Subject: [PATCH 5/5] dartfmt --- lib/src/model.dart | 4 ++-- lib/src/model_utils.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/model.dart b/lib/src/model.dart index 5cbf310566..0bb4e90a38 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -2299,7 +2299,6 @@ abstract class ModelElement extends Nameable } } - if (newModelElement == null) throw "Unknown type ${e.runtimeType}"; if (enclosingClass != null) assert(newModelElement is Inheritable); if (library != null) { @@ -3255,7 +3254,8 @@ class ModelFunctionTypedef extends ModelFunctionTyped { String get name { Element e = element; while (e != null) { - if (e is FunctionTypeAliasElement || e is GenericTypeAliasElement) return e.name; + if (e is FunctionTypeAliasElement || e is GenericTypeAliasElement) + return e.name; e = e.enclosingElement; } assert(false); diff --git a/lib/src/model_utils.dart b/lib/src/model_utils.dart index ef809d98b2..970e7e69a4 100644 --- a/lib/src/model_utils.dart +++ b/lib/src/model_utils.dart @@ -60,7 +60,7 @@ bool hasPrivateName(Element e) { if (e is LibraryElement && (e.identifier.startsWith('dart:_') || ['dart:nativewrappers'].contains(e.identifier))) { - return true; + return true; } if (e is LibraryElement) { List locationParts = e.location.components[0].split(slashes);