From b3ef88dcf7831756c6c330f83600b2c35a29804f Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Tue, 28 Nov 2017 07:49:50 -0800 Subject: [PATCH 1/4] Flatten changes one last time --- appveyor.yml | 2 +- bin/dartdoc.dart | 8 +- lib/dartdoc.dart | 351 +--- lib/src/config.dart | 10 +- lib/src/element_type.dart | 24 +- lib/src/html/html_generator_instance.dart | 55 +- lib/src/html/template_data.dart | 29 +- lib/src/html/templates.dart | 2 +- lib/src/io_utils.dart | 65 +- lib/src/markdown_processor.dart | 67 +- lib/src/model.dart | 1821 +++++++++++------ lib/src/model_utils.dart | 36 +- lib/src/utils.dart | 8 +- lib/src/warnings.dart | 25 +- lib/templates/_sidebar_for_class.html | 62 +- lib/templates/_sidebar_for_enum.html | 62 +- lib/templates/_sidebar_for_library.html | 56 +- lib/templates/class.html | 94 +- lib/templates/enum.html | 94 +- lib/templates/index.html | 10 +- lib/templates/library.html | 64 +- pubspec.lock | 4 +- test/compare_output_test.dart | 2 +- test/dartdoc_test.dart | 25 +- test/io_utils_test.dart | 8 - test/model_test.dart | 341 ++- test/src/utils.dart | 91 +- testing/test_package/lib/example.dart | 39 + testing/test_package/lib/fake.dart | 2 +- .../test_package_docs/ex/Animal-class.html | 6 + .../ex/AnotherParameterizedClass-class.html | 235 +++ .../AnotherParameterizedClass.html | 96 + .../AnotherParameterizedClass}/hashCode.html | 35 +- .../noSuchMethod.html | 35 +- .../operator_equals.html | 35 +- .../runtimeType.html | 35 +- .../AnotherParameterizedClass}/toString.html | 35 +- testing/test_package_docs/ex/Apple-class.html | 6 + testing/test_package_docs/ex/B-class.html | 6 + .../test_package_docs/ex/COLOR-constant.html | 6 + .../ex/COLOR_GREEN-constant.html | 6 + .../ex/COLOR_ORANGE-constant.html | 6 + .../ex/COMPLEX_COLOR-constant.html | 6 + testing/test_package_docs/ex/Cat-class.html | 6 + .../test_package_docs/ex/CatString-class.html | 6 + .../ex/ConstantCat-class.html | 26 +- .../ex/ConstantCat/ConstantCat.html | 10 +- .../ex/ConstantCat/abstractMethod.html | 10 +- .../ex/ConstantCat/isImplemented.html | 10 +- .../ex/ConstantCat/name.html | 10 +- .../ex/Deprecated-class.html | 6 + testing/test_package_docs/ex/Dog-class.html | 36 +- .../ex/Dog/Dog.deprecatedCreate.html | 9 +- testing/test_package_docs/ex/Dog/Dog.html | 9 +- .../test_package_docs/ex/Dog/aFinalField.html | 9 +- .../ex/Dog/aGetterReturningRandomThings.html | 9 +- ...{noSuchMethod.html => aName-constant.html} | 34 +- .../ex/Dog/aProtectedFinalField.html | 9 +- .../ex/Dog/aStaticConstField-constant.html | 11 +- .../ex/Dog/abstractMethod.html | 9 +- .../test_package_docs/ex/Dog/createDog.html | 9 +- .../ex/Dog/deprecatedField.html | 9 +- .../ex/Dog/deprecatedGetter.html | 9 +- .../ex/Dog/deprecatedSetter.html | 9 +- testing/test_package_docs/ex/Dog/foo.html | 9 +- .../ex/Dog/getAnotherClassD.html | 9 +- .../test_package_docs/ex/Dog/getClassA.html | 9 +- .../test_package_docs/ex/Dog/hashCode.html | 124 -- .../ex/Dog/isImplemented.html | 9 +- testing/test_package_docs/ex/Dog/name.html | 9 +- .../ex/Dog/operator_equals.html | 9 +- .../test_package_docs/ex/Dog/runtimeType.html | 124 -- .../ex/Dog/somethingTasty.html | 9 +- .../ex/Dog/staticGetterSetter.html | 9 +- .../test_package_docs/ex/Dog/testGeneric.html | 9 +- .../ex/Dog/testGenericMethod.html | 9 +- .../test_package_docs/ex/Dog/testMethod.html | 9 +- .../test_package_docs/ex/Dog/toString.html | 120 -- .../test_package_docs/ex/Dog/withMacro.html | 9 +- .../test_package_docs/ex/Dog/withMacro2.html | 9 +- testing/test_package_docs/ex/E-class.html | 6 + .../ex/ExtendedShortName-class.html | 259 +++ .../ExtendedShortName/ExtendedShortName.html | 97 + testing/test_package_docs/ex/F-class.html | 22 +- testing/test_package_docs/ex/F/F.html | 8 +- .../ex/F/methodWithGenericParam.html | 8 +- testing/test_package_docs/ex/F/test.html | 8 +- .../ex/ForAnnotation-class.html | 6 + .../ex/HasAnnotation-class.html | 6 + .../test_package_docs/ex/Helper-class.html | 6 + testing/test_package_docs/ex/Klass-class.html | 6 + .../test_package_docs/ex/MY_CAT-constant.html | 6 + .../test_package_docs/ex/MyError-class.html | 6 + .../ex/MyErrorImplements-class.html | 6 + .../ex/MyException-class.html | 6 + .../ex/MyExceptionImplements-class.html | 6 + .../ex/PRETTY_COLORS-constant.html | 6 + .../ex/ParameterizedClass-class.html | 307 +++ .../ParameterizedClass.html | 102 + .../ParameterizedClass/aInheritedField.html | 100 + .../ParameterizedClass/aInheritedGetter.html | 105 + .../ParameterizedClass/aInheritedMethod.html | 101 + .../ParameterizedClass/aInheritedSetter.html | 106 + .../aInheritedTypedefReturningMethod.html | 101 + .../ParameterizedClass}/hashCode.html | 41 +- .../ParameterizedClass}/noSuchMethod.html | 41 +- .../ParameterizedClass}/operator_equals.html | 41 +- .../ex/ParameterizedClass/operator_plus.html | 101 + .../ParameterizedClass}/runtimeType.html | 41 +- .../ParameterizedClass}/toString.html | 41 +- .../ex/ParameterizedTypedef.html | 6 + .../PublicClassExtendsPrivateClass-class.html | 19 +- ...ClassImplementsPrivateInterface-class.html | 6 + .../test_package_docs/ex/ShapeType-class.html | 23 +- .../ex/ShapeType/ellipse-constant.html | 2 +- .../ex/ShapeType/rect-constant.html | 2 +- .../test_package_docs/ex/ShortName-class.html | 257 +++ .../ex/ShortName/ShortName.html | 97 + .../ex/ShortName/aParameter.html | 95 + .../{ConstantCat => ShortName}/hashCode.html | 32 +- .../noSuchMethod.html | 32 +- .../operator_equals.html | 32 +- .../runtimeType.html | 32 +- .../{ConstantCat => ShortName}/toString.html | 32 +- .../ex/SpecializedDuration-class.html | 6 + .../ex/TemplatedClass-class.html | 245 +++ .../ex/TemplatedClass/TemplatedClass.html | 97 + .../ex/TemplatedClass/aMethod.html | 96 + .../TemplatedClass}/hashCode.html | 34 +- .../TemplatedClass}/noSuchMethod.html | 34 +- .../TemplatedClass}/operator_equals.html | 34 +- .../TemplatedClass}/runtimeType.html | 34 +- .../TemplatedClass}/toString.html | 34 +- .../ex/TemplatedInterface-class.html | 356 ++++ .../TemplatedInterface.html | 107 + .../ex/TemplatedInterface/aField.html | 105 + .../ex/TemplatedInterface/aGetter.html | 110 + .../TemplatedInterface/aMethodInterface.html | 106 + .../ex/TemplatedInterface/aSetter.html | 111 + .../aTypedefReturningMethodInterface.html | 106 + .../TypedFunctionsWithoutTypedefs-class.html | 10 +- .../getAFunctionReturningBool.html | 2 +- .../getAFunctionReturningVoid.html | 2 +- .../ex/WithGeneric-class.html | 6 + .../ex/WithGenericSub-class.html | 8 +- .../test_package_docs/ex/aComplexTypedef.html | 10 +- .../ex/aThingToDo-class.html | 6 + .../ex/deprecated-constant.html | 6 + .../test_package_docs/ex/deprecatedField.html | 6 + .../ex/deprecatedGetter.html | 6 + .../ex/deprecatedSetter.html | 6 + testing/test_package_docs/ex/ex-library.html | 46 +- testing/test_package_docs/ex/function1.html | 6 + .../test_package_docs/ex/genericFunction.html | 6 + .../ex/incorrectDocReference-constant.html | 6 + .../incorrectDocReferenceFromEx-constant.html | 6 + testing/test_package_docs/ex/number.html | 6 + .../test_package_docs/ex/processMessage.html | 6 + testing/test_package_docs/ex/y.html | 6 + .../fake/BaseThingy2-class.html | 20 +- .../fake/BaseThingy2/BaseThingy2.html | 10 +- .../fake/BaseThingy2/aImplementingThingy.html | 10 +- .../ClassWithUnusualProperties-class.html | 2 +- .../implicitGetterExplicitSetter.html | 2 +- .../fake/ExtraSpecialList-class.html | 70 +- .../fake/ImplementingThingy-class.html | 20 +- .../ImplementingThingy.html | 10 +- .../fake/ImplementingThingy2-class.html | 20 +- .../ImplementingThingy2.html | 10 +- .../fake/LongFirstLine-class.html | 22 +- .../fake/LongFirstLine/ANSWER-constant.html | 10 +- .../LongFirstLine.fromHasGenerics.html | 10 +- .../LongFirstLine/LongFirstLine.fromMap.html | 10 +- .../fake/LongFirstLine/LongFirstLine.html | 10 +- .../fake/LongFirstLine/THING-constant.html | 12 +- .../fake/LongFirstLine/aStringProperty.html | 10 +- .../fake/LongFirstLine/dynamicGetter.html | 10 +- .../fake/LongFirstLine/meaningOfLife.html | 10 +- .../fake/LongFirstLine/noParams.html | 10 +- .../fake/LongFirstLine/onlySetter.html | 10 +- .../fake/LongFirstLine/operator_multiply.html | 10 +- .../fake/LongFirstLine/operator_plus.html | 10 +- .../fake/LongFirstLine/optionalParams.html | 10 +- .../fake/LongFirstLine/returnString.html | 10 +- .../fake/LongFirstLine/staticGetter.html | 10 +- .../LongFirstLine/staticMethodNoParams.html | 10 +- .../staticMethodReturnsVoid.html | 10 +- .../fake/LongFirstLine/staticOnlySetter.html | 10 +- .../fake/LongFirstLine/twoParams.html | 10 +- .../fake/NewGenericTypedef.html | 2 +- .../test_package_docs/fake/fake-library.html | 2 +- testing/test_package_docs/index.json | 784 ++++--- testing/test_package_small/pubspec.lock | 5 + tool/grind.dart | 2 +- 194 files changed, 7236 insertions(+), 2826 deletions(-) create mode 100644 testing/test_package_docs/ex/AnotherParameterizedClass-class.html create mode 100644 testing/test_package_docs/ex/AnotherParameterizedClass/AnotherParameterizedClass.html rename testing/test_package_docs/{fake/BaseThingy2 => ex/AnotherParameterizedClass}/hashCode.html (58%) rename testing/test_package_docs/{fake/BaseThingy2 => ex/AnotherParameterizedClass}/noSuchMethod.html (59%) rename testing/test_package_docs/{fake/BaseThingy2 => ex/AnotherParameterizedClass}/operator_equals.html (58%) rename testing/test_package_docs/{fake/BaseThingy2 => ex/AnotherParameterizedClass}/runtimeType.html (58%) rename testing/test_package_docs/{fake/BaseThingy2 => ex/AnotherParameterizedClass}/toString.html (57%) rename testing/test_package_docs/ex/Dog/{noSuchMethod.html => aName-constant.html} (80%) delete mode 100644 testing/test_package_docs/ex/Dog/hashCode.html delete mode 100644 testing/test_package_docs/ex/Dog/runtimeType.html delete mode 100644 testing/test_package_docs/ex/Dog/toString.html create mode 100644 testing/test_package_docs/ex/ExtendedShortName-class.html create mode 100644 testing/test_package_docs/ex/ExtendedShortName/ExtendedShortName.html create mode 100644 testing/test_package_docs/ex/ParameterizedClass-class.html create mode 100644 testing/test_package_docs/ex/ParameterizedClass/ParameterizedClass.html create mode 100644 testing/test_package_docs/ex/ParameterizedClass/aInheritedField.html create mode 100644 testing/test_package_docs/ex/ParameterizedClass/aInheritedGetter.html create mode 100644 testing/test_package_docs/ex/ParameterizedClass/aInheritedMethod.html create mode 100644 testing/test_package_docs/ex/ParameterizedClass/aInheritedSetter.html create mode 100644 testing/test_package_docs/ex/ParameterizedClass/aInheritedTypedefReturningMethod.html rename testing/test_package_docs/{fake/ImplementingThingy2 => ex/ParameterizedClass}/hashCode.html (54%) rename testing/test_package_docs/{fake/ImplementingThingy2 => ex/ParameterizedClass}/noSuchMethod.html (54%) rename testing/test_package_docs/{fake/ImplementingThingy2 => ex/ParameterizedClass}/operator_equals.html (54%) create mode 100644 testing/test_package_docs/ex/ParameterizedClass/operator_plus.html rename testing/test_package_docs/{fake/ImplementingThingy2 => ex/ParameterizedClass}/runtimeType.html (54%) rename testing/test_package_docs/{fake/ImplementingThingy2 => ex/ParameterizedClass}/toString.html (52%) create mode 100644 testing/test_package_docs/ex/ShortName-class.html create mode 100644 testing/test_package_docs/ex/ShortName/ShortName.html create mode 100644 testing/test_package_docs/ex/ShortName/aParameter.html rename testing/test_package_docs/ex/{ConstantCat => ShortName}/hashCode.html (62%) rename testing/test_package_docs/ex/{ConstantCat => ShortName}/noSuchMethod.html (63%) rename testing/test_package_docs/ex/{ConstantCat => ShortName}/operator_equals.html (62%) rename testing/test_package_docs/ex/{ConstantCat => ShortName}/runtimeType.html (63%) rename testing/test_package_docs/ex/{ConstantCat => ShortName}/toString.html (61%) create mode 100644 testing/test_package_docs/ex/TemplatedClass-class.html create mode 100644 testing/test_package_docs/ex/TemplatedClass/TemplatedClass.html create mode 100644 testing/test_package_docs/ex/TemplatedClass/aMethod.html rename testing/test_package_docs/{fake/ImplementingThingy => ex/TemplatedClass}/hashCode.html (57%) rename testing/test_package_docs/{fake/ImplementingThingy => ex/TemplatedClass}/noSuchMethod.html (57%) rename testing/test_package_docs/{fake/ImplementingThingy => ex/TemplatedClass}/operator_equals.html (57%) rename testing/test_package_docs/{fake/ImplementingThingy => ex/TemplatedClass}/runtimeType.html (57%) rename testing/test_package_docs/{fake/ImplementingThingy => ex/TemplatedClass}/toString.html (56%) create mode 100644 testing/test_package_docs/ex/TemplatedInterface-class.html create mode 100644 testing/test_package_docs/ex/TemplatedInterface/TemplatedInterface.html create mode 100644 testing/test_package_docs/ex/TemplatedInterface/aField.html create mode 100644 testing/test_package_docs/ex/TemplatedInterface/aGetter.html create mode 100644 testing/test_package_docs/ex/TemplatedInterface/aMethodInterface.html create mode 100644 testing/test_package_docs/ex/TemplatedInterface/aSetter.html create mode 100644 testing/test_package_docs/ex/TemplatedInterface/aTypedefReturningMethodInterface.html create mode 100644 testing/test_package_small/pubspec.lock diff --git a/appveyor.yml b/appveyor.yml index ce1c4db152..50b38dd886 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ # BSD-style license that can be found in the LICENSE file. install: - - ps: wget https://gsdview.appspot.com/dart-archive/channels/stable/raw/latest/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip + - ps: wget https://gsdview.appspot.com/dart-archive/channels/dev/raw/latest/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip - cmd: echo "Unzipping dart-sdk..." - cmd: 7z x dart-sdk.zip -o"C:\tools" -y > nul - set PATH=%PATH%;C:\tools\dart-sdk\bin diff --git a/bin/dartdoc.dart b/bin/dartdoc.dart index a4aca6beb1..9a756fb2bf 100644 --- a/bin/dartdoc.dart +++ b/bin/dartdoc.dart @@ -261,11 +261,11 @@ main(List arguments) async { reexportMinConfidence: double.parse(args['ambiguous-reexport-scorer-min-confidence']), verboseWarnings: args['verbose-warnings'], + excludePackages: args['exclude-packages'], dropTextFrom: dropTextFrom); DartDoc dartdoc = new DartDoc(inputDir, excludeLibraries, sdkDir, generators, - outputDir, packageMeta, includeLibraries, - includeExternals: includeExternals); + outputDir, packageMeta, includeLibraries, includeExternals); dartdoc.onCheckProgress.listen(logProgress); await Chain.capture(() async { @@ -275,7 +275,7 @@ main(List arguments) async { }, zoneSpecification: new ZoneSpecification( print: (Zone self, ZoneDelegate parent, Zone zone, String line) => - logPrint(line) )); + logPrint(line))); }, onError: (e, Chain chain) { if (e is DartDocFailure) { stderr.writeln('\nGeneration failed: ${e}.'); @@ -325,6 +325,8 @@ ArgParser _createArgsParser() { '(optional text next to the package name and version).'); parser.addOption('exclude', allowMultiple: true, splitCommas: true, help: 'Library names to ignore.'); + parser.addOption('exclude-packages', + allowMultiple: true, splitCommas: true, help: 'Package names to ignore.'); parser.addOption('include', allowMultiple: true, splitCommas: true, diff --git a/lib/dartdoc.dart b/lib/dartdoc.dart index 4caa642ead..8c567c0ff9 100644 --- a/lib/dartdoc.dart +++ b/lib/dartdoc.dart @@ -9,33 +9,20 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:analyzer/dart/element/element.dart' show LibraryElement; -import 'package:analyzer/error/error.dart'; -import 'package:analyzer/file_system/file_system.dart' as fileSystem; -import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer/source/package_map_resolver.dart'; -import 'package:analyzer/source/sdk_ext.dart'; -import 'package:analyzer/src/context/builder.dart'; -import 'package:analyzer/src/dart/sdk/sdk.dart'; +import 'package:analyzer/analyzer.dart'; import 'package:analyzer/src/generated/engine.dart'; -import 'package:analyzer/src/generated/java_io.dart'; -import 'package:analyzer/src/generated/sdk.dart'; import 'package:analyzer/src/generated/source.dart'; -import 'package:analyzer/src/generated/source_io.dart'; import 'package:dartdoc/src/utils.dart'; import 'package:html/dom.dart' show Element, Document; import 'package:html/parser.dart' show parse; -import 'package:package_config/discovery.dart' as package_config; import 'package:path/path.dart' as path; import 'package:tuple/tuple.dart'; import 'src/config.dart'; import 'src/generator.dart'; import 'src/html/html_generator.dart'; -import 'src/io_utils.dart'; import 'src/logging.dart'; import 'src/model.dart'; -import 'src/model_utils.dart'; import 'src/package_meta.dart'; import 'src/warnings.dart'; @@ -78,108 +65,98 @@ Future> initGenerators(String url, String relCanonicalPrefix, ]; } -Map> _calculatePackageMap( - fileSystem.Folder dir) { - Map> map = new Map(); - var info = package_config.findPackagesFromFile(dir.toUri()); - - for (String name in info.packages) { - Uri uri = info.asMap()[name]; - fileSystem.Resource resource = - PhysicalResourceProvider.INSTANCE.getResource(uri.toFilePath()); - if (resource is fileSystem.Folder) { - map[name] = [resource]; - } - } - - return map; -} - /// Generates Dart documentation for all public Dart libraries in the given /// directory. -class DartDoc { - final Directory rootDir; - final Directory sdkDir; +class DartDoc extends PackageBuilder { final List generators; final Directory outputDir; - final PackageMeta packageMeta; - final List includes; - final List includeExternals; - final List excludes; final Set writtenFiles = new Set(); // Fires when the self checks make progress. final StreamController _onCheckProgress = new StreamController(sync: true); - Stopwatch _stopwatch; - - DartDoc(this.rootDir, this.excludes, this.sdkDir, this.generators, - this.outputDir, this.packageMeta, this.includes, - {this.includeExternals: const []}); + DartDoc( + Directory rootDir, + List excludes, + Directory sdkDir, + this.generators, + this.outputDir, + PackageMeta packageMeta, + List includes, + List includeExternals) + : super( + rootDir, + excludes, + config.excludePackages, + sdkDir, + packageMeta, + includes, + includeExternals, + config.showWarnings, + config.autoIncludeDependencies); Stream get onCheckProgress => _onCheckProgress.stream; - /// Generate DartDoc documentation. - /// - /// [DartDocResults] is returned if dartdoc succeeds. [DartDocFailure] is - /// thrown if dartdoc fails in an expected way, for example if there is an - /// analysis error in the code. Any other exception can be throw if there is an - /// unexpected failure. - Future generateDocs() async { - _stopwatch = new Stopwatch()..start(); - - List files = packageMeta.isSdk - ? const [] - : findFilesToDocumentInPackage(rootDir.path).toList(); - - // TODO(jcollins-g): seems like most of this belongs in the Package constructor - List libraries = _parseLibraries(files, includeExternals); - - if (includes != null && includes.isNotEmpty) { - Iterable knownLibraryNames = libraries.map((l) => l.name); - Set notFound = - new Set.from(includes).difference(new Set.from(knownLibraryNames)); - if (notFound.isNotEmpty) { - throw 'Did not find: [${notFound.join(', ')}] in ' - 'known libraries: [${knownLibraryNames.join(', ')}]'; + @override + void logAnalysisErrors(Set sources) { + List errorInfos = []; + // TODO(jcollins-g): figure out why sources can't contain includeExternals + // or embedded SDK components without having spurious(?) analysis errors. + // That seems wrong. + for (Source source in sources) { + context.computeErrors(source); + AnalysisErrorInfo info = context.getErrors(source); + List<_Error> errors = [info] + .expand((AnalysisErrorInfo info) { + return info.errors.map((error) => + new _Error(error, info.lineInfo, packageMeta.dir.path)); + }) + .where((_Error error) => error.isError) + .toList() + ..sort(); + // TODO(jcollins-g): Why does the SDK have analysis errors? Annotations + // seem correctly formed. + if (errors.isNotEmpty && !source.uri.toString().startsWith('dart:')) { + errorInfos.add(info); + logWarning( + 'analysis errors from source: ${source.uri.toString()} (${source.toString()}'); + errors.forEach(logWarning); } - libraries.removeWhere((lib) => !includes.contains(lib.name)); - } else { - // remove excluded libraries - excludes.forEach((pattern) { - libraries.removeWhere((lib) { - return lib.name.startsWith(pattern) || lib.name == pattern; - }); - }); } - PackageWarningOptions warningOptions = new PackageWarningOptions(); - // TODO(jcollins-g): explode this into detailed command line options. - if (config != null && config.showWarnings) { - for (PackageWarning kind in PackageWarning.values) { - warningOptions.warn(kind); - } - } - Package package; - if (config != null && config.autoIncludeDependencies) { - package = Package.withAutoIncludedDependencies( - libraries, packageMeta, warningOptions); - libraries = package.libraries.map((l) => l.element).toList(); - // remove excluded libraries again, in case they are picked up through - // dependencies. - excludes.forEach((pattern) { - libraries.removeWhere((lib) { - return lib.name.startsWith(pattern) || lib.name == pattern; - }); - }); + List<_Error> errors = errorInfos + .expand((AnalysisErrorInfo info) { + return info.errors.map((error) => + new _Error(error, info.lineInfo, packageMeta.dir.path)); + }) + .where((_Error error) => error.isError) + .toList() + ..sort(); + + if (errors.isNotEmpty) { + int len = errors.length; + throw new DartDocFailure( + "encountered ${len} analysis error${len == 1 ? '' : 's'}"); } - package = new Package(libraries, packageMeta, warningOptions); + } + + Package package; - // Go through docs of every model element in package to prebuild the macros index - // TODO(jcollins-g): move index building into a cached-on-demand generation - // like most other bits in [Package]. - package.allCanonicalModelElements.forEach((m) => m.documentation); + /// Generate DartDoc documentation. + /// + /// [DartDocResults] is returned if dartdoc succeeds. [DartDocFailure] is + /// thrown if dartdoc fails in an expected way, for example if there is an + /// analysis error in the code. + Future generateDocs() async { + Stopwatch _stopwatch = new Stopwatch()..start(); + double seconds; + package = buildPackage(); + seconds = _stopwatch.elapsedMilliseconds / 1000.0; + logInfo( + "Initialized dartdoc with ${package.libraries.length} librar${package.libraries.length == 1 ? 'y' : 'ies'} " + "in ${seconds.toStringAsFixed(1)} seconds"); + _stopwatch.reset(); // Create the out directory. if (!outputDir.existsSync()) outputDir.createSync(recursive: true); @@ -199,12 +176,12 @@ class DartDoc { "and ${errors} ${pluralize('error', errors)}"); } - double seconds = _stopwatch.elapsedMilliseconds / 1000.0; + seconds = _stopwatch.elapsedMilliseconds / 1000.0; logInfo( - "Documented ${package.libraries.length} librar${package.libraries.length == 1 ? 'y' : 'ies'} " + "Documented ${package.publicLibraries.length} public librar${package.publicLibraries.length == 1 ? 'y' : 'ies'} " "in ${seconds.toStringAsFixed(1)} seconds"); - if (package.libraries.isEmpty) { + if (package.publicLibraries.isEmpty) { throw new DartDocFailure( "dartdoc could not find any libraries to document. Run `pub get` and try again."); } @@ -221,9 +198,9 @@ class DartDoc { {String referredFrom}) { // Ordinarily this would go in [Package.warn], but we don't actually know what // ModelElement to warn on yet. - Locatable warnOnElement; - Set referredFromElements = new Set(); - Set warnOnElements; + Warnable warnOnElement; + Set referredFromElements = new Set(); + Set warnOnElements; // Make all paths relative to origin. if (path.isWithin(origin, warnOn)) { @@ -426,172 +403,6 @@ class DartDoc { _doOrphanCheck(package, origin, visited); _doSearchIndexCheck(package, origin, visited); } - - List _parseLibraries( - List files, List includeExternals) { - Set libraries = new Set(); - DartSdk sdk = new FolderBasedDartSdk(PhysicalResourceProvider.INSTANCE, - PhysicalResourceProvider.INSTANCE.getFolder(sdkDir.path)); - List resolvers = []; - - fileSystem.Folder cwd = - PhysicalResourceProvider.INSTANCE.getResource(rootDir.path); - Map> packageMap = _calculatePackageMap(cwd); - - EmbedderSdk embedderSdk; - DartUriResolver embedderResolver; - if (packageMap != null) { - resolvers.add(new SdkExtUriResolver(packageMap)); - resolvers.add(new PackageMapUriResolver( - PhysicalResourceProvider.INSTANCE, packageMap)); - var embedderYamls = new EmbedderYamlLocator(packageMap).embedderYamls; - embedderSdk = - new EmbedderSdk(PhysicalResourceProvider.INSTANCE, embedderYamls); - embedderResolver = new DartUriResolver(embedderSdk); - if (embedderSdk.urlMappings.length == 0) { - // The embedder uri resolver has no mappings. Use the default Dart SDK - // uri resolver. - resolvers.add(new DartUriResolver(sdk)); - } else { - // The embedder uri resolver has mappings, use it instead of the default - // Dart SDK uri resolver. - resolvers.add(embedderResolver); - } - } else { - resolvers.add(new DartUriResolver(sdk)); - } - resolvers.add( - new fileSystem.ResourceUriResolver(PhysicalResourceProvider.INSTANCE)); - - SourceFactory sourceFactory = new SourceFactory(resolvers); - - // TODO(jcollins-g): fix this so it actually obeys analyzer options files. - var options = new AnalysisOptionsImpl()..enableAssertInitializer = true; - - AnalysisEngine.instance.processRequiredPlugins(); - - AnalysisContext context = AnalysisEngine.instance.createAnalysisContext() - ..analysisOptions = options - ..sourceFactory = sourceFactory; - - if (packageMeta.isSdk) { - libraries - .addAll(new Set()..addAll(getSdkLibrariesToDocument(sdk, context))); - } - - List sources = []; - - void processLibrary(String filePath) { - String name = filePath; - if (name.startsWith(Directory.current.path)) { - name = name.substring(Directory.current.path.length); - if (name.startsWith(Platform.pathSeparator)) name = name.substring(1); - } - logInfo('parsing ${name}...'); - JavaFile javaFile = new JavaFile(filePath).getAbsoluteFile(); - Source source = new FileBasedSource(javaFile); - - // TODO(jcollins-g): remove the manual reversal using embedderSdk when we - // upgrade to analyzer-0.30 (where DartUriResolver implements - // restoreAbsolute) - Uri uri = embedderSdk?.fromFileUri(source.uri)?.uri; - if (uri != null) { - source = new FileBasedSource(javaFile, uri); - } else { - uri = context.sourceFactory.restoreUri(source); - if (uri != null) { - source = new FileBasedSource(javaFile, uri); - } - } - sources.add(source); - if (context.computeKindOf(source) == SourceKind.LIBRARY) { - LibraryElement library = context.computeLibraryElement(source); - if (!hasPrivateName(library)) libraries.add(library); - } - } - - files.forEach(processLibrary); - - if ((embedderSdk != null) && (embedderSdk.urlMappings.length > 0)) { - embedderSdk.urlMappings.keys.forEach((String dartUri) { - Source source = embedderSdk.mapDartUri(dartUri); - processLibrary(source.fullName); - }); - } - - // Ensure that the analysis engine performs all remaining work. - AnalysisResult result = context.performAnalysisTask(); - while (result.hasMoreWork) { - result = context.performAnalysisTask(); - } - - // Use the includeExternals. - for (Source source in context.librarySources) { - LibraryElement library = context.computeLibraryElement(source); - String libraryName = Library.getLibraryName(library); - var fullPath = source.fullName; - - if (includeExternals.any((string) => fullPath.endsWith(string))) { - if (libraries.map(Library.getLibraryName).contains(libraryName)) { - continue; - } - libraries.add(library); - } else if (config != null && - config.autoIncludeDependencies && - libraryName != '') { - File searchFile = new File(fullPath); - searchFile = - new File(path.join(searchFile.parent.path, 'pubspec.yaml')); - bool foundLibSrc = false; - while (!foundLibSrc && searchFile.parent != null) { - if (searchFile.existsSync()) break; - List pathParts = path.split(searchFile.parent.path); - // This is a pretty intensely hardcoded convention, but there seems to - // to be no other way to identify what might be a "top level" library - // here. If lib/src is in the path between the file and the pubspec, - // assume that this is supposed to be private. - if (pathParts.length < 2) break; - pathParts = pathParts.sublist(pathParts.length - 2, pathParts.length); - foundLibSrc = - path.join(pathParts[0], pathParts[1]) == path.join('lib', 'src'); - searchFile = new File( - path.join(searchFile.parent.parent.path, 'pubspec.yaml')); - } - if (foundLibSrc) continue; - libraries.add(library); - } - } - - List errorInfos = []; - - for (Source source in sources) { - context.computeErrors(source); - errorInfos.add(context.getErrors(source)); - } - - List<_Error> errors = errorInfos - .expand((AnalysisErrorInfo info) { - return info.errors.map((error) => - new _Error(error, info.lineInfo, packageMeta.dir.path)); - }) - .where((_Error error) => error.isError) - .toList() - ..sort(); - - double seconds = _stopwatch.elapsedMilliseconds / 1000.0; - logInfo("parsed ${libraries.length} ${pluralize('file', libraries.length)} " - "in ${seconds.toStringAsFixed(1)} seconds"); - _stopwatch.reset(); - - if (errors.isNotEmpty) { - errors.forEach(logWarning); - int len = errors.length; - throw new DartDocFailure( - "encountered ${len} analysis error${len == 1 ? '' : 's'}"); - } - - return libraries.toList(); - } } /// This class is returned if dartdoc fails in an expected way (for instance, if diff --git a/lib/src/config.dart b/lib/src/config.dart index c7ec56ce80..527839e874 100644 --- a/lib/src/config.dart +++ b/lib/src/config.dart @@ -18,6 +18,7 @@ class Config { final double reexportMinConfidence; final bool verboseWarnings; final List dropTextFrom; + final List excludePackages; Config._( this.inputDir, this.showWarnings, @@ -29,7 +30,8 @@ class Config { this.categoryOrder, this.reexportMinConfidence, this.verboseWarnings, - this.dropTextFrom); + this.dropTextFrom, + this.excludePackages); } Config _config; @@ -46,7 +48,8 @@ void setConfig( List categoryOrder, double reexportMinConfidence: 0.1, bool verboseWarnings: true, - List dropTextFrom}) { + List dropTextFrom, + List excludePackages}) { _config = new Config._( inputDir, showWarnings, @@ -58,5 +61,6 @@ void setConfig( categoryOrder ?? const [], reexportMinConfidence, verboseWarnings, - dropTextFrom ?? const []); + dropTextFrom ?? const [], + excludePackages ?? const []); } diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index 6081f4d7b2..be0e5ad18a 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -10,7 +10,7 @@ import 'package:analyzer/dart/element/type.dart'; import 'model.dart'; -class ElementType { +class ElementType extends Privacy { final DartType _type; final ModelElement element; String _linkedName; @@ -19,6 +19,8 @@ class ElementType { assert(element != null); } + DartType get type => _type; + bool get isDynamic => _type.isDynamic; bool get isFunctionType => (_type is FunctionType); @@ -27,6 +29,17 @@ class ElementType { bool get isParameterType => (_type is TypeParameterType); + /// This type is a public type if the underlying, canonical element is public. + /// This avoids discarding the resolved type information as canonicalization + /// would ordinarily do. + @override + bool get isPublic { + Class canonicalClass = + element.package.findCanonicalModelElementFor(element.element) ?? + element; + return canonicalClass.isPublic; + } + String get linkedName { if (_linkedName == null) { StringBuffer buf = new StringBuffer(); @@ -58,7 +71,10 @@ class ElementType { return _linkedName; } - String get name => _type.name; + String get name { + if (_type.name == null) return _type.element.name; + return _type.name; + } ModelElement get returnElement { Element e; @@ -84,9 +100,7 @@ class ElementType { } else { typeArguments = type.typeFormals.map((f) => f.type); } - return typeArguments - .map(_getElementTypeFrom) - .toList(); + return typeArguments.map(_getElementTypeFrom).toList(); } else { return (_type as ParameterizedType) .typeArguments diff --git a/lib/src/html/html_generator_instance.dart b/lib/src/html/html_generator_instance.dart index bfbb4344d8..de1c9b2d61 100644 --- a/lib/src/html/html_generator_instance.dart +++ b/lib/src/html/html_generator_instance.dart @@ -7,6 +7,7 @@ import 'dart:convert' show JsonEncoder; import 'dart:io' show Directory, File; import 'package:collection/collection.dart' show compareNatural; +import 'package:dartdoc/src/model_utils.dart'; import 'package:path/path.dart' as path; import '../logging.dart'; @@ -102,86 +103,75 @@ class HtmlGeneratorInstance implements HtmlOptions { generatePackage(); - for (var lib in package.libraries) { + for (var lib in filterNonDocumented(package.libraries)) { + // if (lib.name != 'extract_messages') continue; generateLibrary(package, lib); - for (var clazz in lib.allClasses) { - // TODO(jcollins-g): consider refactor so that only the canonical - // ModelElements show up in these lists - if (!clazz.isCanonical) continue; - + for (var clazz in filterNonDocumented(lib.allClasses)) { generateClass(package, lib, clazz); - for (var constructor in clazz.constructors) { + for (var constructor in filterNonDocumented(clazz.constructors)) { if (!constructor.isCanonical) continue; generateConstructor(package, lib, clazz, constructor); } - for (var constant in clazz.constants) { + for (var constant in filterNonDocumented(clazz.constants)) { if (!constant.isCanonical) continue; generateConstant(package, lib, clazz, constant); } - for (var property in clazz.staticProperties) { + for (var property in filterNonDocumented(clazz.staticProperties)) { if (!property.isCanonical) continue; generateProperty(package, lib, clazz, property); } - for (var property in clazz.propertiesForPages) { + for (var property in filterNonDocumented(clazz.propertiesForPages)) { if (!property.isCanonical) continue; generateProperty(package, lib, clazz, property); } - for (var method in clazz.methodsForPages) { + for (var method in filterNonDocumented(clazz.methodsForPages)) { if (!method.isCanonical) continue; generateMethod(package, lib, clazz, method); } - for (var operator in clazz.operatorsForPages) { + for (var operator in filterNonDocumented(clazz.operatorsForPages)) { if (!operator.isCanonical) continue; generateMethod(package, lib, clazz, operator); } - for (var method in clazz.staticMethods) { + for (var method in filterNonDocumented(clazz.staticMethods)) { if (!method.isCanonical) continue; generateMethod(package, lib, clazz, method); } } - for (var eNum in lib.enums) { - if (!eNum.isCanonical) continue; + for (var eNum in filterNonDocumented(lib.enums)) { generateEnum(package, lib, eNum); - for (var property in eNum.propertiesForPages) { - if (!property.isCanonical) continue; + for (var property in filterNonDocumented(eNum.propertiesForPages)) { generateProperty(package, lib, eNum, property); } - for (var operator in eNum.operatorsForPages) { - if (!operator.isCanonical) continue; + for (var operator in filterNonDocumented(eNum.operatorsForPages)) { generateMethod(package, lib, eNum, operator); } - for (var method in eNum.methodsForPages) { - if (!method.isCanonical) continue; + for (var method in filterNonDocumented(eNum.methodsForPages)) { generateMethod(package, lib, eNum, method); } } - for (var constant in lib.constants) { - if (!constant.isCanonical) continue; + for (var constant in filterNonDocumented(lib.constants)) { generateTopLevelConstant(package, lib, constant); } - for (var property in lib.properties) { - if (!property.isCanonical) continue; + for (var property in filterNonDocumented(lib.properties)) { generateTopLevelProperty(package, lib, property); } - for (var function in lib.functions) { - if (!function.isCanonical) continue; + for (var function in filterNonDocumented(lib.functions)) { generateFunction(package, lib, function); } - for (var typeDef in lib.typedefs) { - if (!typeDef.isCanonical) continue; + for (var typeDef in filterNonDocumented(lib.typedefs)) { generateTypeDef(package, lib, typeDef); } } @@ -195,7 +185,8 @@ class HtmlGeneratorInstance implements HtmlOptions { } void generateLibrary(Package package, Library lib) { - logInfo('Generating docs for library ${lib.name} from ${lib.path}...'); + logInfo( + 'Generating docs for library ${lib.name} from ${lib.element.source.uri}...'); if (!lib.isAnonymous && !lib.hasDocumentation) { package.warnOnElement(lib, PackageWarning.noLibraryLevelDocs); } @@ -306,7 +297,9 @@ class HtmlGeneratorInstance implements HtmlOptions { assumeNullNonExistingProperty: false, errorOnMissingProperty: true); _writeFile(fullName, content); - if (data.self is ModelElement) documentedElements.add(data.self); + if (data.self is ModelElement) { + documentedElements.add(data.self); + } } /// [content] must be either [String] or [List]. diff --git a/lib/src/html/template_data.dart b/lib/src/html/template_data.dart index e14b6e6320..77d211e1bf 100644 --- a/lib/src/html/template_data.dart +++ b/lib/src/html/template_data.dart @@ -135,18 +135,19 @@ class LibraryTemplateData extends TemplateData { List get navLinks => [package]; @override Iterable getSubNavItems() sync* { - if (library.hasClasses) + if (library.hasPublicClasses) yield new Subnav('Classes', '${library.href}#classes'); - if (library.hasConstants) + if (library.hasPublicConstants) yield new Subnav('Constants', '${library.href}#constants'); - if (library.hasProperties) + if (library.hasPublicProperties) yield new Subnav('Properties', '${library.href}#properties'); - if (library.hasFunctions) + if (library.hasPublicFunctions) yield new Subnav('Functions', '${library.href}#functions'); - if (library.hasEnums) yield new Subnav('Enums', '${library.href}#enums'); - if (library.hasTypedefs) + if (library.hasPublicEnums) + yield new Subnav('Enums', '${library.href}#enums'); + if (library.hasPublicTypedefs) yield new Subnav('Typedefs', '${library.href}#typedefs'); - if (library.hasExceptions) + if (library.hasPublicExceptions) yield new Subnav('Exceptions', '${library.href}#exceptions'); } @@ -188,19 +189,19 @@ class ClassTemplateData extends TemplateData { String get htmlBase => '..'; @override Iterable getSubNavItems() sync* { - if (clazz.hasConstructors) + if (clazz.hasPublicConstructors) yield new Subnav('Constructors', '${clazz.href}#constructors'); - if (clazz.hasProperties) + if (clazz.hasPublicProperties) yield new Subnav('Properties', '${clazz.href}#instance-properties'); - if (clazz.hasMethods) + if (clazz.hasPublicMethods) yield new Subnav('Methods', '${clazz.href}#instance-methods'); - if (clazz.hasOperators) + if (clazz.hasPublicOperators) yield new Subnav('Operators', '${clazz.href}#operators'); - if (clazz.hasStaticProperties) + if (clazz.hasPublicStaticProperties) yield new Subnav('Static Properties', '${clazz.href}#static-properties'); - if (clazz.hasStaticMethods) + if (clazz.hasPublicStaticMethods) yield new Subnav('Static Methods', '${clazz.href}#static-methods'); - if (clazz.hasConstants) + if (clazz.hasPublicConstants) yield new Subnav('Constants', '${clazz.href}#constants'); } diff --git a/lib/src/html/templates.dart b/lib/src/html/templates.dart index ae4793d31d..d84e4d6b31 100644 --- a/lib/src/html/templates.dart +++ b/lib/src/html/templates.dart @@ -29,7 +29,7 @@ const _partials = const [ 'source_code', 'sidebar_for_library', 'accessor_getter', - 'accessor_setter' + 'accessor_setter', ]; Future> _loadPartials(List headerPaths, diff --git a/lib/src/io_utils.dart b/lib/src/io_utils.dart index 2a79be8330..87baa5e077 100644 --- a/lib/src/io_utils.dart +++ b/lib/src/io_utils.dart @@ -7,7 +7,9 @@ library dartdoc.io_utils; import 'dart:io'; +import 'package:dartdoc/src/config.dart'; import 'package:path/path.dart' as path; +import 'package:package_config/discovery.dart' as package_config; /// Lists the contents of [dir]. /// @@ -48,61 +50,6 @@ Iterable _doList(String dir, Set listedDirectories, } } -/// Given a package name, explore the directory and pull out all top level -/// library files in the "lib" directory to document. -Iterable findFilesToDocumentInPackage(String packageDir) sync* { - final String sep = path.separator; - - var packageLibDir = path.join(packageDir, 'lib'); - var packageLibSrcDir = path.join(packageLibDir, 'src'); - - // To avoid analyzing package files twice, only files with paths not - // containing '/packages' will be added. The only exception is if the file - // to analyze already has a '/package' in its path. - for (var lib - in listDir(packageDir, recursive: true, listDir: _packageDirList)) { - if (lib.endsWith('.dart') && - (!lib.contains('${sep}packages${sep}') || - packageDir.contains('${sep}packages${sep}'))) { - // Only include libraries within the lib dir that are not in lib/src - if (path.isWithin(packageLibDir, lib) && - !path.isWithin(packageLibSrcDir, lib)) { - // Only add the file if it does not contain 'part of' - var contents = new File(lib).readAsStringSync(); - - if (contents.contains(_newLinePartOfRegexp) || - contents.startsWith(_partOfRegexp)) { - // NOOP: it's a part file - } else { - yield lib; - } - } - } - } -} - -/// If [dir] contains both a `lib` directory and a `pubspec.yaml` file treat -/// it like a package and only return the `lib` dir. -/// -/// This ensures that packages don't have non-`lib` content documented. -Iterable _packageDirList(Directory dir) sync* { - var entities = dir.listSync(); - - var pubspec = entities.firstWhere( - (e) => e is File && path.basename(e.path) == 'pubspec.yaml', - orElse: () => null); - - var libDir = entities.firstWhere( - (e) => e is Directory && path.basename(e.path) == 'lib', - orElse: () => null); - - if (pubspec != null && libDir != null) { - yield libDir; - } else { - yield* entities; - } -} - /// Converts `.` and `:` into `-`, adding a ".html" extension. /// /// For example: @@ -110,8 +57,8 @@ Iterable _packageDirList(Directory dir) sync* { /// * dart.dartdoc => dart_dartdoc.html /// * dart:core => dart_core.html String getFileNameFor(String name) => - '${name.replaceAll(_libraryNameRegexp, '-')}.html'; + '${name.replaceAll(libraryNameRegexp, '-')}.html'; -final _libraryNameRegexp = new RegExp('[.:]'); -final _partOfRegexp = new RegExp('part of '); -final _newLinePartOfRegexp = new RegExp('\npart of '); +final libraryNameRegexp = new RegExp('[.:]'); +final partOfRegexp = new RegExp('part of '); +final newLinePartOfRegexp = new RegExp('\npart of '); diff --git a/lib/src/markdown_processor.dart b/lib/src/markdown_processor.dart index d8aa91340f..76fd23c3e2 100644 --- a/lib/src/markdown_processor.dart +++ b/lib/src/markdown_processor.dart @@ -11,6 +11,7 @@ import 'dart:math'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/src/dart/element/member.dart' show Member; +import 'package:dartdoc/src/model_utils.dart'; import 'package:html/parser.dart' show parse; import 'package:markdown/markdown.dart' as md; import 'package:tuple/tuple.dart'; @@ -237,7 +238,7 @@ NodeList _getCommentRefs(Documentable documentable) { /// Returns null if element is a parameter. MatchingLinkResult _getMatchingLinkElement( - String codeRef, Documentable element, List commentRefs) { + String codeRef, Warnable element, List commentRefs) { // By debugging inspection, it seems correct to not warn when we don't have // CommentReferences; there's actually nothing that needs resolving in // that case. @@ -314,8 +315,10 @@ MatchingLinkResult _getMatchingLinkElement( refModelElement = new ModelElement.from(searchElement, refLibrary, getter: getter, setter: setter); if (!refModelElement.isCanonical) { - refModelElement - .warn(PackageWarning.noCanonicalFound, referredFrom: [element]); + if (refLibrary.isPublicAndPackageDocumented) { + refModelElement + .warn(PackageWarning.noCanonicalFound, referredFrom: [element]); + } // Don't warn about doc references because that's covered by the no // canonical library found message. return new MatchingLinkResult(null, null, warn: false); @@ -387,14 +390,14 @@ Map> _findRefElementCache; // TODO(jcollins-g): Subcomponents of this function shouldn't be adding nulls to results, strip the // removes out that are gratuitous and debug the individual pieces. // TODO(jcollins-g): A complex package winds up spending a lot of cycles in here. Optimize. -Element _findRefElementInLibrary(String codeRef, ModelElement element, +Element _findRefElementInLibrary(String codeRef, Warnable element, List commentRefs, Class preferredClass) { assert(element != null); assert(element.package.allLibrariesAdded); String codeRefChomped = codeRef.replaceFirst(isConstructor, ''); - final Library library = element.library; + final Library library = element is ModelElement ? element.library : null; final Package package = library.package; final Set results = new Set(); @@ -425,8 +428,19 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element, // We don't link these, but this keeps us from emitting warnings. Be sure to // get members of parameters too. // TODO(jcollins-g): link to classes that are the types of parameters, where known - results.addAll(element.allParameters.where((p) => - p.name == codeRefChomped || codeRefChomped.startsWith("${p.name}."))); + if (element is ModelElement) { + results.addAll(element.allParameters.where((p) => + p.name == codeRefChomped || codeRefChomped.startsWith("${p.name}."))); + } + + results.remove(null); + // Maybe this ModelElement has type parameters, and this is one of them. + if (results.isEmpty) { + if (element is TypeParameters) { + results.addAll((element as TypeParameters).typeParameters.where((p) => + p.name == codeRefChomped || codeRefChomped.startsWith("${p.name}."))); + } + } results.remove(null); if (results.isEmpty) { @@ -454,7 +468,7 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element, if (results.isEmpty && realClass != null) { for (Class superClass - in realClass.superChain.map((et) => et.element as Class)) { + in realClass.publicSuperChain.map((et) => et.element as Class)) { if (!tryClasses.contains(superClass)) { _getResultsForClass( superClass, codeRefChomped, results, codeRef, package); @@ -474,7 +488,7 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element, if (results.isEmpty && _findRefElementCache == null) { assert(package.allLibrariesAdded); _findRefElementCache = new Map(); - for (final modelElement in package.allModelElements) { + for (final modelElement in filterNonDocumented(package.allModelElements)) { _findRefElementCache.putIfAbsent( modelElement.fullyQualifiedNameWithoutLibrary, () => new Set()); _findRefElementCache.putIfAbsent( @@ -520,6 +534,7 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element, } } } + results.remove(null); // This could conceivably be a reference to an enum member. They don't show up in allModelElements. // TODO(jcollins-g): Put enum members in allModelElements with useful hrefs without blowing up other assumptions about what that means. @@ -543,10 +558,10 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element, } } } + results.remove(null); Element result; - results.remove(null); if (results.length > 1) { // If this name could refer to a class or a constructor, prefer the class. if (results.any((r) => r is Class)) { @@ -555,6 +570,12 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element, } if (results.length > 1) { + if (results.any((r) => r.library.packageName == library.packageName)) { + results.removeWhere((r) => r.library.packageName != library.packageName); + } + } + + if (results.length > 1 && element is ModelElement) { // Attempt to disambiguate using the library. // TODO(jcollins-g): we could have saved ourselves some work by using the analyzer // to search the namespace, somehow. Do that instead. @@ -564,6 +585,18 @@ Element _findRefElementInLibrary(String codeRef, ModelElement element, } } + if (results.length > 1) { + // This may refer to an element with the same name in multiple libraries + // in an external package, e.g. Matrix4 in vector_math and vector_math_64. + // Disambiguate by attempting to figure out which of them our package + // is actually using by checking the import/export graph. + if (results.any( + (r) => library.packageImportedExportedLibraries.contains(r.library))) { + results.removeWhere( + (r) => !library.packageImportedExportedLibraries.contains(r.library)); + } + } + // TODO(jcollins-g): This is only necessary because we had to jettison commentRefs // as a way to figure this out. We could reintroduce commentRefs, or we could // compute this via other means. @@ -634,7 +667,7 @@ void _getResultsForClass(Class tryClass, String codeRefChomped, // TODO(jcollins-g): This makes our caller ~O(n^2) vs length of superChain. // Fortunately superChains are short, but optimize this if it matters. superChain - .addAll(tryClass.superChainRaw.map((t) => t.returnElement as Class)); + .addAll(tryClass.superChain.map((t) => t.returnElement as Class)); List codeRefParts = codeRefChomped.split('.'); for (final c in superChain) { // TODO(jcollins-g): add a hash-map-enabled lookup function to Class? @@ -693,10 +726,10 @@ void _getResultsForClass(Class tryClass, String codeRefChomped, } } -String _linkDocReference(String codeRef, Documentable documentable, - NodeList commentRefs) { +String _linkDocReference( + String codeRef, Warnable warnable, NodeList commentRefs) { MatchingLinkResult result; - result = _getMatchingLinkElement(codeRef, documentable, commentRefs); + result = _getMatchingLinkElement(codeRef, warnable, commentRefs); final ModelElement linkedElement = result.element; final String label = result.label ?? codeRef; if (linkedElement != null) { @@ -713,8 +746,8 @@ String _linkDocReference(String codeRef, Documentable documentable, } } else { if (result.warn) { - documentable.warn(PackageWarning.unresolvedDocReference, - message: codeRef, referredFrom: documentable.documentationFrom); + warnable.warn(PackageWarning.unresolvedDocReference, + message: codeRef, referredFrom: warnable.documentationFrom); } return '${HTML_ESCAPE.convert(label)}'; } @@ -889,7 +922,7 @@ class MarkdownDocument extends md.Document { } class Documentation { - final Documentable _element; + final Canonicalization _element; Documentation.forElement(this._element) {} bool _hasExtendedDocs; diff --git a/lib/src/model.dart b/lib/src/model.dart index 54fd815a45..ea33089c58 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -18,14 +18,28 @@ import 'package:analyzer/dart/ast/ast.dart' VariableDeclarationList; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; +import 'package:analyzer/file_system/file_system.dart' as fileSystem; +import 'package:analyzer/file_system/physical_file_system.dart'; +import 'package:analyzer/source/package_map_resolver.dart'; +import 'package:analyzer/source/sdk_ext.dart'; // TODO(jcollins-g): Stop using internal analyzer structures somehow. +import 'package:analyzer/src/context/builder.dart'; +import 'package:analyzer/src/dart/sdk/sdk.dart'; +import 'package:analyzer/src/generated/engine.dart'; +import 'package:analyzer/src/generated/java_io.dart'; import 'package:analyzer/src/generated/resolver.dart' show Namespace, NamespaceBuilder, InheritanceManager; +import 'package:analyzer/src/generated/sdk.dart'; +import 'package:analyzer/src/generated/source.dart'; +import 'package:analyzer/src/generated/source_io.dart'; import 'package:analyzer/src/generated/utilities_dart.dart' show ParameterKind; -import 'package:analyzer/src/dart/element/member.dart' show Member; +import 'package:analyzer/src/dart/element/member.dart' + show ExecutableMember, Member, ParameterMember; import 'package:collection/collection.dart'; +import 'package:dartdoc/src/io_utils.dart'; import 'package:path/path.dart' as p; import 'package:tuple/tuple.dart'; +import 'package:package_config/discovery.dart' as package_config; import 'config.dart'; import 'element_type.dart'; @@ -103,20 +117,16 @@ final RegExp locationSplitter = new RegExp(r"(package:|[\\/;.])"); /// children of that class inheriting the same member will point to the same /// place in the documentation, and we pick a canonical class because that's /// the one in the public namespace that will be documented. -abstract class Inheritable { - Element get element; - ModelElement get enclosingElement; - Package get package; +abstract class Inheritable implements ModelElement { bool get isInherited; - bool get isPublic; bool _canonicalEnclosingClassIsSet = false; Class _canonicalEnclosingClass; Class _definingEnclosingClass; ModelElement get definingEnclosingElement { if (_definingEnclosingClass == null) { - _definingEnclosingClass = new ModelElement.from(element.enclosingElement, - package.findOrCreateLibraryFor(element.enclosingElement)); + _definingEnclosingClass = + new ModelElement.fromElement(element.enclosingElement, package); } return _definingEnclosingClass; } @@ -130,29 +140,50 @@ abstract class Inheritable { : searchElement; // TODO(jcollins-g): generate warning if an inherited element's definition // is in an intermediate non-canonical class in the inheritance chain? + Class previous; + Class previousNonSkippable; for (Class c in inheritance.reversed) { // Filter out mixins. if (c.contains(searchElement)) { + if ((package.inheritThrough.contains(previous) && + c != definingEnclosingElement) || + (package.inheritThrough.contains(c) && + c == definingEnclosingElement)) { + return (previousNonSkippable.memberByExample(this) as Inheritable) + .canonicalEnclosingElement; + } Class canonicalC = package.findCanonicalModelElementFor(c.element); // TODO(jcollins-g): invert this lookup so traversal is recursive // starting from the ModelElement. if (canonicalC != null) { + assert(canonicalC.isCanonical); + //assert(this.inheritance.contains(canonicalC)); assert(canonicalC.contains(searchElement)); - _canonicalEnclosingClass = c; + _canonicalEnclosingClass = canonicalC; break; } } + previous = c; + if (!package.inheritThrough.contains(c)) { + previousNonSkippable = c; + } } - if (definingEnclosingElement.isCanonical && isPublic) { + // This is still OK because we're never supposed to cloak public + // classes. + if (definingEnclosingElement.isCanonical && + definingEnclosingElement.isPublic) { assert(definingEnclosingElement == _canonicalEnclosingClass); } } else { - if (enclosingElement.isCanonical) { - _canonicalEnclosingClass = enclosingElement; - } + _canonicalEnclosingClass = + package.findCanonicalModelElementFor(enclosingElement.element); } _canonicalEnclosingClassIsSet = true; + assert(_canonicalEnclosingClass == null || + _canonicalEnclosingClass.isDocumented); } + assert(_canonicalEnclosingClass == null || + (_canonicalEnclosingClass.isDocumented)); return _canonicalEnclosingClass; } @@ -161,12 +192,15 @@ abstract class Inheritable { inheritance.addAll((enclosingElement as Class).inheritanceChain); if (!inheritance.contains(definingEnclosingElement) && definingEnclosingElement != null) { - // TODO(jcollins-g): Why does this happen? - inheritance.add(definingEnclosingElement); + assert(definingEnclosingElement == package.objectElement); } - // TODO(jcollins-g): Sometimes, we don't get Object added on. Why? + // Unless the code explicitly extends dart-core's Object, we won't get + // an entry here. So add it. if (inheritance.last != package.objectElement && - package.objectElement != null) inheritance.add(package.objectElement); + package.objectElement != null) { + inheritance.add(package.objectElement); + } + assert(inheritance.where((e) => e == package.objectElement).length == 1); return inheritance; } } @@ -177,22 +211,26 @@ class InheritableAccessor extends Accessor with Inheritable { /// if [element] is in [inheritedAccessors]. factory InheritableAccessor.from(PropertyAccessorElement element, Set inheritedAccessors, Class enclosingClass) { + InheritableAccessor accessor; if (element == null) return null; if (inheritedAccessors.contains(element)) { - return new ModelElement.from(element, enclosingClass.library, + accessor = new ModelElement.from(element, enclosingClass.library, enclosingClass: enclosingClass); + } else { + accessor = new ModelElement.from(element, enclosingClass.library); } - return new ModelElement.from(element, enclosingClass.library); + return accessor; } ModelElement _enclosingElement; bool _isInherited = false; InheritableAccessor(PropertyAccessorElement element, Library library) - : super(element, library); + : super(element, library, null); InheritableAccessor.inherited( - PropertyAccessorElement element, Library library, this._enclosingElement) - : super(element, library) { + PropertyAccessorElement element, Library library, this._enclosingElement, + {Member originalMember}) + : super(element, library, originalMember) { _isInherited = true; } @@ -221,8 +259,9 @@ class Accessor extends ModelElement implements EnclosedElement { GetterSetterCombo _enclosingCombo; - Accessor(PropertyAccessorElement element, Library library) - : super(element, library); + Accessor( + PropertyAccessorElement element, Library library, Member originalMember) + : super(element, library, originalMember); get linkedReturnType { assert(isGetter); @@ -245,9 +284,9 @@ class Accessor extends ModelElement /// Call exactly once to set the enclosing combo for this Accessor. set enclosingCombo(GetterSetterCombo combo) { - assert(_enclosingCombo == null || combo == _enclosingCombo); - assert(combo != null); - _enclosingCombo = combo; + assert(_enclosingCombo == null || combo == _enclosingCombo); + assert(combo != null); + _enclosingCombo = combo; } bool get isSynthetic => element.isSynthetic; @@ -274,7 +313,8 @@ class Accessor extends ModelElement @override String get computeDocumentationComment { if (isSynthetic) { - String docComment = (element as PropertyAccessorElement).variable.documentationComment; + String docComment = + (element as PropertyAccessorElement).variable.documentationComment; // If we're a setter, only display something if we have something different than the getter. // TODO(jcollins-g): modify analyzer to do this itself? if (isGetter || @@ -344,7 +384,7 @@ class Accessor extends ModelElement _overriddenElementIsSet = true; Element parent = element.enclosingElement; if (parent is ClassElement) { - for (InterfaceType t in getAllSupertypes(parent)) { + for (InterfaceType t in parent.allSupertypes) { Element accessor = this.isGetter ? t.getGetter(element.name) : t.getSetter(element.name); @@ -352,8 +392,8 @@ class Accessor extends ModelElement if (accessor is Member) { accessor = Package.getBasestElement(accessor); } - Class parentClass = new ModelElement.from( - t.element, package.findOrCreateLibraryFor(t.element)); + Class parentClass = + new ModelElement.fromElement(t.element, package); List possibleFields = []; possibleFields.addAll(parentClass.allInstanceProperties); possibleFields.addAll(parentClass.staticProperties); @@ -383,7 +423,9 @@ class Accessor extends ModelElement PropertyAccessorElement get _accessor => (element as PropertyAccessorElement); } -class Class extends ModelElement implements EnclosedElement { +class Class extends ModelElement + with TypeParameters + implements EnclosedElement { List _mixins; ElementType _supertype; List _interfaces; @@ -405,52 +447,27 @@ class Class extends ModelElement implements EnclosedElement { List _inheritedProperties; List _allInstanceProperties; - Class(ClassElement element, Library library) : super(element, library) { - Package p = library.package; - _modelType = new ElementType(_cls.type, this); - + Class(ClassElement element, Library library) : super(element, library, null) { _mixins = _cls.mixins .map((f) { - Library lib = new Library(f.element.library, p); - ElementType t = - new ElementType(f, new ModelElement.from(f.element, lib)); + ElementType t = new ElementType( + f, new ModelElement.fromElement(f.element, package)); return t; }) .where((mixin) => mixin != null) .toList(growable: false); if (_cls.supertype != null && _cls.supertype.element.supertype != null) { - Library lib = package.findOrCreateLibraryFor(_cls.supertype.element); - - _supertype = new ElementType( - _cls.supertype, new ModelElement.from(_cls.supertype.element, lib)); + _supertype = new ElementType(_cls.supertype, + new ModelElement.fromElement(_cls.supertype.element, package)); } _interfaces = _cls.interfaces - .map((f) { - var lib = new Library(f.element.library, p); - var t = new ElementType(f, new ModelElement.from(f.element, lib)); - var exclude = t.element.element.isPrivate; - if (exclude) { - return null; - } else { - return t; - } - }) - .where((it) => it != null) + .map((f) => new ElementType( + f, new ModelElement.fromElement(f.element, package))) .toList(growable: false); } - List _inheritanceAndInterfaces; - List get inheritanceAndInterfaces { - if (_inheritanceAndInterfaces == null) { - _inheritanceAndInterfaces = [] - ..addAll(inheritanceChain) - ..addAll(interfaceChain.map((et) => et.element as Class)); - } - return _inheritanceAndInterfaces; - } - List get allInstanceMethods { if (_allInstanceMethods != null) return _allInstanceMethods; _allInstanceMethods = [] @@ -463,7 +480,10 @@ class Class extends ModelElement implements EnclosedElement { return _allInstanceMethods; } - bool get allInstanceMethodsInherited => + Iterable get allPublicInstanceMethods => + filterNonPublic(allInstanceMethods); + + bool get allPublicInstanceMethodsInherited => instanceMethods.every((f) => f.isInherited); List get allInstanceProperties { @@ -481,9 +501,6 @@ class Class extends ModelElement implements EnclosedElement { return _allInstanceProperties; } - bool get allInstancePropertiesInherited => - instanceProperties.every((f) => f.isInherited); - Iterable get allAccessors { return allInstanceProperties.expand((f) { List getterSetters = []; @@ -493,6 +510,12 @@ class Class extends ModelElement implements EnclosedElement { }); } + Iterable get allPublicInstanceProperties => + filterNonPublic(allInstanceProperties); + + bool get allPublicInstancePropertiesInherited => + allPublicInstanceProperties.every((f) => f.isInherited); + List get allOperators { if (_allOperators != null) return _allOperators; _allOperators = [] @@ -505,7 +528,10 @@ class Class extends ModelElement implements EnclosedElement { return _allOperators; } - bool get allOperatorsInherited => operators.every((f) => f.isInherited); + Iterable get allPublicOperators => filterNonPublic(allOperators); + + bool get allPublicOperatorsInherited => + allPublicOperators.every((f) => f.isInherited); List get constants { if (_constants != null) return _constants; @@ -515,6 +541,8 @@ class Class extends ModelElement implements EnclosedElement { return _constants; } + Iterable get publicConstants => filterNonPublic(constants); + Map _allElements; Map get allElements { if (_allElements == null) { @@ -527,10 +555,40 @@ class Class extends ModelElement implements EnclosedElement { return _allElements; } + /// This class might be canonical for elements it does not contain. + /// See [canonicalEnclosingElement]. bool contains(Element element) => allElements.containsKey(element); ModelElement findModelElement(Element element) => allElements[element]; + Map> _membersByName; + + /// Given a ModelElement that is a member of some other class, return + /// a member of this class that has the same name and return type. + /// + /// This enables object substitution for canonicalization, such as Interceptor + /// for Object. + ModelElement memberByExample(ModelElement example) { + if (_membersByName == null) { + _membersByName = new Map(); + for (ModelElement me in allModelElements) { + if (!_membersByName.containsKey(me.name)) + _membersByName[me.name] = new List(); + _membersByName[me.name].add(me); + } + } + ModelElement member; + Iterable possibleMembers = _membersByName[example.name] + .where((e) => e.runtimeType == example.runtimeType); + if (example.runtimeType == Accessor) { + possibleMembers = possibleMembers.where( + (e) => (example as Accessor).isGetter == (e as Accessor).isGetter); + } + member = possibleMembers.first; + assert(possibleMembers.length == 1); + return member; + } + final Set _allModelElements = new Set(); List get allModelElements { if (_allModelElements.isEmpty) { @@ -543,7 +601,7 @@ class Class extends ModelElement implements EnclosedElement { ..addAll(constructors) ..addAll(staticMethods) ..addAll(staticProperties) - ..addAll(_typeParameters); + ..addAll(typeParameters); } return _allModelElements.toList(); } @@ -557,17 +615,16 @@ class Class extends ModelElement implements EnclosedElement { List get constructors { if (_constructors != null) return _constructors; - _constructors = _cls.constructors - .map((e) { - return new ModelElement.from(e, library); - }) - .where((e) => e.isPublic) - .toList(growable: true) - ..sort(byName); + _constructors = _cls.constructors.map((e) { + return new ModelElement.from(e, library); + }).toList(growable: true) + ..sort(byName); return _constructors; } + Iterable get publicConstructors => filterNonPublic(constructors); + /// Returns the library that encloses this element. @override ModelElement get enclosingElement => library; @@ -579,44 +636,42 @@ class Class extends ModelElement implements EnclosedElement { return kind; } - bool get hasConstants => constants.isNotEmpty; - - bool get hasConstructors => constructors.isNotEmpty; + bool get hasPublicConstants => publicConstants.isNotEmpty; - bool get hasImplementors => implementors.isNotEmpty; + bool get hasPublicConstructors => publicConstructors.isNotEmpty; - bool get hasInheritedMethods => inheritedMethods.isNotEmpty; + bool get hasPublicImplementors => publicImplementors.isNotEmpty; bool get hasInstanceMethods => instanceMethods.isNotEmpty; bool get hasInstanceProperties => instanceProperties.isNotEmpty; - bool get hasInterfaces => interfaces.isNotEmpty; + bool get hasPublicInterfaces => publicInterfaces.isNotEmpty; - bool get hasMethods => - instanceMethods.isNotEmpty || inheritedMethods.isNotEmpty; + bool get hasPublicMethods => + publicInstanceMethods.isNotEmpty || publicInheritedMethods.isNotEmpty; - bool get hasMixins => mixins.isNotEmpty; + bool get hasPublicMixins => publicMixins.isNotEmpty; bool get hasModifiers => - hasMixins || + hasPublicMixins || hasAnnotations || - hasInterfaces || - hasSupertype || - hasImplementors; + hasPublicInterfaces || + hasPublicSuperChainReversed || + hasPublicImplementors; - bool get hasOperators => - operators.isNotEmpty || inheritedOperators.isNotEmpty; + bool get hasPublicOperators => + publicOperators.isNotEmpty || publicInheritedOperators.isNotEmpty; - bool get hasProperties => - inheritedProperties.isNotEmpty || instanceProperties.isNotEmpty; + bool get hasPublicProperties => + publicInheritedProperties.isNotEmpty || + publicInstanceProperties.isNotEmpty; - bool get hasStaticMethods => staticMethods.isNotEmpty; + bool get hasPublicStaticMethods => publicStaticMethods.isNotEmpty; - bool get hasStaticProperties => staticProperties.isNotEmpty; + bool get hasPublicStaticProperties => publicStaticProperties.isNotEmpty; - bool get hasSupertype => - (supertype != null && supertype.element != package.objectElement); + bool get hasPublicSuperChainReversed => publicSuperChainReversed.isNotEmpty; @override String get href { @@ -624,12 +679,11 @@ class Class extends ModelElement implements EnclosedElement { return '${canonicalLibrary.dirName}/$fileName'; } - /// Returns all the implementors of the class specified. - List get implementors { - return (package._implementors[href] != null - ? package._implementors[href] - : []) - .toList(growable: false) as List; + /// Returns all the implementors of this class. + Iterable get publicImplementors { + return filterNonPublic(findCanonicalFor(package._implementors[href] != null + ? package._implementors[href] + : [])); } List get inheritedMethods { @@ -679,16 +733,9 @@ class Class extends ModelElement implements EnclosedElement { !value.isOperator && value.enclosingElement != null) { Method m; - if (!package.isDocumented(value.enclosingElement)) { - m = new ModelElement.from(value, library, enclosingClass: this); - if (m.isPublic) { - _inheritedMethods.add(m); - _genPageMethods.add(m); - } - } else { - m = new ModelElement.from(value, library, enclosingClass: this); - if (m.isPublic) _inheritedMethods.add(m); - } + m = new ModelElement.from(value, library, enclosingClass: this); + _inheritedMethods.add(m); + _genPageMethods.add(m); } } @@ -697,7 +744,11 @@ class Class extends ModelElement implements EnclosedElement { return _inheritedMethods; } - // TODO(jcollins-g): this is very copy-paste from inheritedMethods that the + Iterable get publicInheritedMethods => filterNonPublic(inheritedMethods); + + bool get hasPublicInheritedMethods => publicInheritedMethods.isNotEmpty; + + // TODO(jcollins-g): this is very copy-paste from inheritedMethods now that the // constructor is always [ModelElement.from]. Fix this. List get inheritedOperators { if (_inheritedOperators != null) return _inheritedOperators; @@ -738,15 +789,9 @@ class Class extends ModelElement implements EnclosedElement { } for (ExecutableElement value in values.values) { - if (!package.isDocumented(value.enclosingElement)) { - Operator o = - new ModelElement.from(value, library, enclosingClass: this); - _inheritedOperators.add(o); - _genPageOperators.add(o); - } else { - _inheritedOperators - .add(new ModelElement.from(value, library, enclosingClass: this)); - } + Operator o = new ModelElement.from(value, library, enclosingClass: this); + _inheritedOperators.add(o); + _genPageOperators.add(o); } _inheritedOperators.sort(byName); @@ -754,6 +799,9 @@ class Class extends ModelElement implements EnclosedElement { return _inheritedOperators; } + Iterable get publicInheritedOperators => + filterNonPublic(inheritedOperators); + List get inheritedProperties { if (_inheritedProperties == null) { _inheritedProperties = allFields.where((f) => f.isInherited).toList() @@ -762,6 +810,9 @@ class Class extends ModelElement implements EnclosedElement { return _inheritedProperties; } + Iterable get publicInheritedProperties => + filterNonPublic(inheritedProperties); + List get instanceMethods { if (_instanceMethods != null) return _instanceMethods; @@ -774,6 +825,8 @@ class Class extends ModelElement implements EnclosedElement { return _instanceMethods; } + Iterable get publicInstanceMethods => instanceMethods; + List get instanceProperties { if (_instanceFields != null) return _instanceFields; _instanceFields = allFields @@ -784,7 +837,10 @@ class Class extends ModelElement implements EnclosedElement { return _instanceFields; } + Iterable get publicInstanceProperties => + filterNonPublic(instanceProperties); List get interfaces => _interfaces; + Iterable get publicInterfaces => filterNonPublic(interfaces); List _interfaceChain; List get interfaceChain { @@ -800,10 +856,8 @@ class Class extends ModelElement implements EnclosedElement { bool get isAbstract => _cls.isAbstract; - // TODO(jcollins-g): Something still not quite right with privacy detection, - // we shouldn't be checking for underscores here. @override - bool get isCanonical => super.isCanonical && !name.startsWith('_'); + bool get isCanonical => super.isCanonical && isPublic; bool get isErrorOrException { bool _doCheck(InterfaceType type) { @@ -826,26 +880,9 @@ class Class extends ModelElement implements EnclosedElement { List get methodsForPages => _genPageMethods.toList(growable: false); - List get mixinsRaw => _mixins; - - // TODO(jcollins-g): This method knows nothing about public/private or - // canonicalization of elements not in this package. Fix this when we add - // multiple-package awareness. - List filterNonPublicTypes(List rawTypes) { - List publicList = []; - for (ElementType type in rawTypes) { - if (!hasPrivateName(type.element.element)) publicList.add(type); - } - return publicList; - } - - List get mixins => filterNonPublicTypes(mixinsRaw); + List get mixins => _mixins; - @override - String get nameWithGenerics { - if (!modelType.isParameterizedType || _typeParameters.isEmpty) return name; - return '$name<${_typeParameters.map((t) => t.name).join(', ')}>'; - } + Iterable get publicMixins => filterNonPublic(mixins); List get operators { if (_operators != null) return _operators; @@ -857,6 +894,8 @@ class Class extends ModelElement implements EnclosedElement { return _operators; } + Iterable get publicOperators => filterNonPublic(operators); + List get operatorsForPages => new UnmodifiableListView(_genPageOperators.toList()); @@ -868,8 +907,7 @@ class Class extends ModelElement implements EnclosedElement { List get propertiesForPages { if (_propertiesForPages == null) { _propertiesForPages = [] - ..addAll(instanceProperties) - ..addAll(inheritedProperties) + ..addAll(allInstanceProperties) ..sort(byName); } return _propertiesForPages; @@ -884,6 +922,8 @@ class Class extends ModelElement implements EnclosedElement { return _staticMethods; } + Iterable get publicStaticMethods => filterNonPublic(staticMethods); + List get staticProperties { if (_staticFields != null) return _staticFields; _staticFields = allFields @@ -895,24 +935,38 @@ class Class extends ModelElement implements EnclosedElement { return _staticFields; } + Iterable get publicStaticProperties => + filterNonPublic(staticProperties); + /// Not the same as superChain as it may include mixins. + /// It's really not even the same as ordinary Dart inheritance, either, + /// because we pretend that interfaces are part of the inheritance chain + /// to include them in the set of things we might link to for documentation + /// purposes in abstract classes. List _inheritanceChain; List get inheritanceChain { if (_inheritanceChain == null) { _inheritanceChain = []; _inheritanceChain.add(this); - _inheritanceChain - .addAll(mixinsRaw.reversed.map((e) => (e.returnElement as Class))); /// Caching should make this recursion a little less painful. - for (Class c in superChainRaw.map((e) => (e.returnElement as Class))) { + for (Class c in mixins.reversed.map((e) => (e.returnElement as Class))) { + _inheritanceChain.addAll(c.inheritanceChain); + } + + for (Class c in superChain.map((e) => (e.returnElement as Class))) { _inheritanceChain.addAll(c.inheritanceChain); } + + /// Interfaces need to come last, because classes in the superChain might + /// implement them even when they aren't mentioned. + _inheritanceChain.addAll( + interfaces.expand((e) => (e.element as Class).inheritanceChain)); } return _inheritanceChain.toList(growable: false); } - List get superChainRaw { + List get superChain { List typeChain = []; var parent = _supertype; while (parent != null) { @@ -922,10 +976,10 @@ class Class extends ModelElement implements EnclosedElement { return typeChain; } - List get superChainRawReversed => - superChainRaw.reversed.toList(); - List get superChain => filterNonPublicTypes(superChainRaw); - List get superChainReversed => superChain.reversed.toList(); + Iterable get superChainReversed => superChain.reversed; + Iterable get publicSuperChain => filterNonPublic(superChain); + Iterable get publicSuperChainReversed => + publicSuperChain.toList().reversed; ElementType get supertype => _supertype; @@ -938,17 +992,14 @@ class Class extends ModelElement implements EnclosedElement { library.inheritanceManager.getMembersInheritedFromInterfaces(element); Set inheritedAccessors = new Set(); - inheritedAccessors.addAll(cmap.values - .where((e) => e is PropertyAccessorElement) - .map((e) => Package.getBasestElement(e) as PropertyAccessorElement)); + inheritedAccessors + .addAll(cmap.values.where((e) => e is PropertyAccessorElement)); // Interfaces are subordinate to members inherited from classes, so don't // add this to our accessor set if we already have something inherited from classes. - inheritedAccessors.addAll(imap.values - .where((e) => e is PropertyAccessorElement && !cmap.containsKey(e.name)) - .map((e) => Package.getBasestElement(e) as PropertyAccessorElement)); + inheritedAccessors.addAll(imap.values.where( + (e) => e is PropertyAccessorElement && !cmap.containsKey(e.name))); - assert(!inheritedAccessors.any((e) => e is Member)); // This structure keeps track of inherited accessors, allowing lookup // by field name (stripping the '=' from setters). Map> accessorMap = new Map(); @@ -979,9 +1030,7 @@ class Class extends ModelElement implements EnclosedElement { // Now we only have inherited accessors who aren't associated with // anything in cls._fields. for (String fieldName in accessorMap.keys) { - List elements = accessorMap[fieldName] - .map((e) => Package.getBasestElement(e)) - .toList(); + List elements = accessorMap[fieldName].toList(); PropertyAccessorElement getterElement = elements.firstWhere((e) => e.isGetter, orElse: () => null); PropertyAccessorElement setterElement = @@ -1008,7 +1057,7 @@ class Class extends ModelElement implements EnclosedElement { Accessor setter = new InheritableAccessor.from(setterElement, inheritedAccessors, this); // Rebind getterElement/setterElement as ModelElement.from can resolve - // MultiplyInheritedExecutableElements. + // MultiplyInheritedExecutableElements or resolve Members. getterElement = getter?.element; setterElement = setter?.element; assert(!(getter == null && setter == null)); @@ -1016,9 +1065,9 @@ class Class extends ModelElement implements EnclosedElement { // Pick an appropriate FieldElement to represent this element. // Only hard when dealing with a synthetic Field. if (getter != null && setter == null) { - f = Package.getBasestElement(getterElement.variable); + f = getterElement.variable; } else if (getter == null && setter != null) { - f = Package.getBasestElement(setterElement.variable); + f = setterElement.variable; } else /* getter != null && setter != null */ { // In cases where a Field is composed of two Accessors defined in // different places in the inheritance chain, there are two FieldElements @@ -1026,9 +1075,9 @@ class Class extends ModelElement implements EnclosedElement { // to this class on the inheritance chain. if ((setter.enclosingElement as Class) .isInheritingFrom(getter.enclosingElement)) { - f = Package.getBasestElement(setterElement.variable); + f = setterElement.variable; } else { - f = Package.getBasestElement(getterElement.variable); + f = getterElement.variable; } } } @@ -1045,9 +1094,7 @@ class Class extends ModelElement implements EnclosedElement { // this better, somehow. field = new ModelElement.from(f, library, getter: getter, setter: setter); } - if (field.isPublic) { - _fields.add(field); - } + _fields.add(field); } ClassElement get _cls => (element as ClassElement); @@ -1055,19 +1102,17 @@ class Class extends ModelElement implements EnclosedElement { List get _methods { if (_allMethods != null) return _allMethods; - _allMethods = _cls.methods - .map((e) { - return new ModelElement.from(e, library); - }) - .where((e) => e.isPublic) - .toList(growable: false) - ..sort(byName); + _allMethods = _cls.methods.map((e) { + return new ModelElement.from(e, library); + }).toList(growable: false) + ..sort(byName); return _allMethods; } // a stronger hash? - List get _typeParameters => _cls.typeParameters.map((f) { + @override + List get typeParameters => _cls.typeParameters.map((f) { var lib = new Library(f.enclosingElement.library, package); return new ModelElement.from(f, lib); }).toList(); @@ -1084,7 +1129,7 @@ class Constructor extends ModelElement with SourceCodeMixin implements EnclosedElement { Constructor(ConstructorElement element, Library library) - : super(element, library); + : super(element, library, null); @override ModelElement get enclosingElement => @@ -1113,15 +1158,18 @@ class Constructor extends ModelElement @override String get kind => 'constructor'; + String _name; @override String get name { - String constructorName = element.name; - Class c = new ModelElement.from(element.enclosingElement, library) as Class; - if (constructorName.isEmpty) { - return c.name; - } else { - return '${c.name}.$constructorName'; + if (_name == null) { + String constructorName = element.name; + if (constructorName.isEmpty) { + _name = enclosingElement.name; + } else { + _name = '${enclosingElement.name}.$constructorName'; + } } + return _name; } String get shortName { @@ -1137,8 +1185,7 @@ class Constructor extends ModelElement /// Bridges the gap between model elements and packages, /// both of which have documentation. -abstract class Documentable implements Warnable { - String get name; +abstract class Documentable extends Nameable { String get documentation; String get documentationAsHtml; bool get hasDocumentation; @@ -1146,10 +1193,77 @@ abstract class Documentable implements Warnable { String get oneLineDoc; Documentable get overriddenDocumentedElement; Package get package; + bool get isDocumented; +} + +/// Classes extending this class have canonicalization support in Dartdoc. +abstract class Canonicalization extends Object + with Locatable + implements Documentable { + bool get isCanonical; + Library get canonicalLibrary; + + List scoreCanonicalCandidates(List libraries) { + return libraries.map((l) => scoreElementWithLibrary(l)).toList()..sort(); + } + + ScoredCandidate scoreElementWithLibrary(Library lib) { + ScoredCandidate scoredCandidate = new ScoredCandidate(this, lib); + Iterable resplit(Set items) sync* { + for (String item in items) { + for (String subItem in item.split('_')) { + yield subItem; + } + } + } + + // Large boost for @canonicalFor, essentially overriding all other concerns. + if (lib.canonicalFor.contains(fullyQualifiedName)) { + scoredCandidate.alterScore(5.0, 'marked @canonicalFor'); + } + // Penalty for deprecated libraries. + if (lib.isDeprecated) scoredCandidate.alterScore(-1.0, 'is deprecated'); + // Give a big boost if the library has the package name embedded in it. + if (package.namePieces.intersection(lib.namePieces).length > 0) { + scoredCandidate.alterScore(1.0, 'embeds package name'); + } + // Give a tiny boost for libraries with long names, assuming they're + // more specific (and therefore more likely to be the owner of this symbol). + scoredCandidate.alterScore(.01 * lib.namePieces.length, 'name is long'); + // If we don't know the location of this element, return our best guess. + // TODO(jcollins-g): is that even possible? + assert(!locationPieces.isEmpty); + if (locationPieces.isEmpty) return scoredCandidate; + // The more pieces we have of the location in our library name, the more we should boost our score. + scoredCandidate.alterScore( + lib.namePieces.intersection(locationPieces).length.toDouble() / + locationPieces.length.toDouble(), + 'element location shares parts with name'); + // If pieces of location at least start with elements of our library name, boost the score a little bit. + double scoreBoost = 0.0; + for (String piece in resplit(locationPieces)) { + for (String namePiece in lib.namePieces) { + if (piece.startsWith(namePiece)) { + scoreBoost += 0.001; + } + } + } + scoredCandidate.alterScore( + scoreBoost, 'element location parts start with parts of name'); + return scoredCandidate; + } } class Dynamic extends ModelElement { - Dynamic(Element element, Library library) : super(element, library); + @override + Package package; + + Dynamic(Element element, Library library, Package p) + : super(element, library, null) { + package = p; + assert(package != null || library != null); + if (p == null) package = library.package; + } @override ModelElement get enclosingElement => throw new UnsupportedError(''); @@ -1204,7 +1318,7 @@ class EnumField extends Field { : super(element, library, getter, null); @override - String get constantValue { + String get constantValueBase { if (name == 'values') { return 'const List<${_field.enclosingElement.name}>'; } else { @@ -1260,7 +1374,6 @@ class EnumField extends Field { class Field extends ModelElement with GetterSetterCombo, Inheritable, SourceCodeMixin implements EnclosedElement { - String _constantValue; bool _isInherited = false; Class _enclosingClass; @override @@ -1269,10 +1382,10 @@ class Field extends ModelElement final InheritableAccessor setter; Field(FieldElement element, Library library, this.getter, this.setter) - : super(element, library) { - _setModelType(); + : super(element, library, null) { if (getter != null) getter.enclosingCombo = this; if (setter != null) setter.enclosingCombo = this; + _setModelType(); } factory Field.inherited(FieldElement element, Class enclosingClass, @@ -1290,26 +1403,15 @@ class Field extends ModelElement String get documentation { // Verify that hasSetter and hasGetterNoSetter are mutually exclusive, // to prevent displaying more or less than one summary. - Set assertCheck = new Set() - ..addAll([hasPublicSetter, hasPublicGetterNoSetter]); - assert(assertCheck.containsAll([true, false])); + if (isPublic) { + Set assertCheck = new Set() + ..addAll([hasPublicSetter, hasPublicGetterNoSetter]); + assert(assertCheck.containsAll([true, false])); + } + documentationFrom; return super.documentation; } - String get constantValue { - if (_constantValue != null) return _constantValue; - - if (_field.computeNode() == null) return null; - var v = _field.computeNode().toSource(); - if (v == null) return null; - var string = v.substring(v.indexOf('=') + 1, v.length).trim(); - _constantValue = string.replaceAll("${modelType.name}", "${modelType.linkedName}"); - - return _constantValue; - } - - String get constantValueTruncated => truncateString(constantValue, 200); - @override ModelElement get enclosingElement { if (_enclosingClass == null) { @@ -1441,15 +1543,38 @@ abstract class GetterSetterCombo implements ModelElement { return allFeatures; } - @override ModelElement enclosingElement; bool get isInherited; + String _constantValueBase; + String get constantValueBase { + if (_constantValueBase == null) { + if (element.computeNode() != null) { + var v = element.computeNode().toSource(); + if (v == null) return null; + var string = v.substring(v.indexOf('=') + 1, v.length).trim(); + _constantValueBase = + const HtmlEscape(HtmlEscapeMode.UNKNOWN).convert(string); + } + } + return _constantValueBase; + } + + String linkifyWithModelType(String text) { + RegExp r = new RegExp("\\b${modelType.name}\\b"); + return text?.replaceAll(r, modelType.linkedName); + } + + String get constantValue => linkifyWithModelType(constantValueBase); + + String get constantValueTruncated => + linkifyWithModelType(truncateString(constantValueBase, 200)); + /// Returns true if both accessors are synthetic. bool get hasSyntheticAccessors { - if ((hasPublicGetter && getter.element.isSynthetic) || - (hasPublicSetter && setter.element.isSynthetic)) { + if ((hasPublicGetter && getter.isSynthetic) || + (hasPublicSetter && setter.isSynthetic)) { return true; } return false; @@ -1485,7 +1610,6 @@ abstract class GetterSetterCombo implements ModelElement { hasPublicSetter && setter.documentation.isNotEmpty); - String _oneLineDoc; @override String get oneLineDoc { if (_oneLineDoc == null) { @@ -1549,12 +1673,6 @@ abstract class GetterSetterCombo implements ModelElement { @override List get parameters => setter.parameters; - @override - String get genericParameters { - if (hasSetter) return setter.genericParameters; - return null; - } - @override String get linkedParamsNoMetadata { if (hasSetter) return setter.linkedParamsNoMetadata; @@ -1613,7 +1731,7 @@ class Library extends ModelElement { return package.findOrCreateLibraryFor(element); } - Library._(LibraryElement element, this.package) : super(element, null) { + Library._(LibraryElement element, this.package) : super(element, null, null) { if (element == null) throw new ArgumentError.notNull('element'); _exportedNamespace = new NamespaceBuilder().createExportNamespaceForLibrary(element); @@ -1634,12 +1752,10 @@ class Library extends ModelElement { Accessor setter; if (e is GetterSetterCombo) { if (e.hasGetter) { - getter = new ModelElement.from(e.getter.element, - package.findOrCreateLibraryFor(e.getter.element)); + getter = new ModelElement.fromElement(e.getter.element, package); } if (e.hasSetter) { - setter = new ModelElement.from(e.setter.element, - package.findOrCreateLibraryFor(e.setter.element)); + setter = new ModelElement.fromElement(e.setter.element, package); } } return new ModelElement.from( @@ -1653,14 +1769,38 @@ class Library extends ModelElement { List get allClasses => _allClasses; - List get classes { + Iterable get classes { return _allClasses .where((c) => !c.isErrorOrException) .toList(growable: false); } + SdkLibrary get sdkLib { + if (package.sdkLibrarySources.containsKey(element.librarySource)) { + return package.sdkLibrarySources[element.librarySource]; + } + return null; + } + + @override + bool get isPublic { + if (!super.isPublic) return false; + if (sdkLib != null && (sdkLib.isInternal || !sdkLib.isDocumented)) { + return false; + } + return true; + } + + /// A special case where the SDK has defined that we should not document + /// this library. This is implemented by tweaking canonicalization so + /// even though the library is public and part of the Package's list, + /// we don't count it as a candidate for canonicalization. + bool get isSdkUndocumented => (sdkLib != null && !sdkLib.isDocumented); + + Iterable get publicClasses => filterNonPublic(classes); + List _constants; - List get constants { + Iterable get constants { if (_constants == null) { // _getVariables() is already sorted. _constants = @@ -1669,7 +1809,61 @@ class Library extends ModelElement { return _constants; } - String get dirName => name.replaceAll(':', '-'); + Set _packageImportedExportedLibraries; + + /// Returns all libraries either imported by or exported by any public library + /// this library's package. (Not [Package], but sharing a package name). + /// + /// Note: will still contain non-public libraries because those can be + /// imported or exported. + // TODO(jcollins-g): move this to [Package] once it really knows about + // more than one package. + Set get packageImportedExportedLibraries { + if (_packageImportedExportedLibraries == null) { + _packageImportedExportedLibraries = new Set(); + package.publicLibraries + .where((l) => l.packageName == packageName) + .forEach((l) { + _packageImportedExportedLibraries.addAll(l.importedExportedLibraries); + }); + } + return _packageImportedExportedLibraries; + } + + Set _importedExportedLibraries; + + /// Returns all libraries either imported by or exported by this library, + /// recursively. + Set get importedExportedLibraries { + if (_importedExportedLibraries == null) { + _importedExportedLibraries = new Set(); + Set importedExportedLibraryElements = new Set(); + importedExportedLibraryElements + .addAll((element as LibraryElement).importedLibraries); + importedExportedLibraryElements + .addAll((element as LibraryElement).exportedLibraries); + for (LibraryElement l in importedExportedLibraryElements) { + Library lib = new ModelElement.from(l, library); + _importedExportedLibraries.add(lib); + _importedExportedLibraries.addAll(lib.importedExportedLibraries); + } + } + return _importedExportedLibraries; + } + + Iterable get publicConstants => filterNonPublic(constants); + + String _dirName; + String get dirName { + if (_dirName == null) { + _dirName = name; + if (isAnonymous) { + _dirName = nameFromPath; + } + _dirName = _dirName.replaceAll(':', '-').replaceAll('/', '_'); + } + return _dirName; + } Set _canonicalFor; @@ -1727,13 +1921,14 @@ class Library extends ModelElement { .where((element) => element is ClassElement && element.isEnum)); _enums = enumClasses .map((e) => new ModelElement.from(e, this)) - .where((e) => e.isPublic) .toList(growable: false) ..sort(byName); return _enums; } + Iterable get publicEnums => filterNonPublic(enums); + List get exceptions { return _allClasses .where((c) => c.isErrorOrException) @@ -1741,6 +1936,8 @@ class Library extends ModelElement { ..sort(byName); } + Iterable get publicExceptions => filterNonPublic(exceptions); + String get fileName => '$dirName-library.html'; List get functions { @@ -1754,30 +1951,29 @@ class Library extends ModelElement { elements.addAll(_exportedNamespace.definedNames.values .where((element) => element is FunctionElement)); - _functions = elements - .map((e) { - return new ModelElement.from(e, this); - }) - .where((e) => e.isPublic) - .toList(growable: false) - ..sort(byName); + _functions = elements.map((e) { + return new ModelElement.from(e, this); + }).toList(growable: false) + ..sort(byName); return _functions; } - bool get hasClasses => classes.isNotEmpty; + Iterable get publicFunctions => filterNonPublic(functions); + + bool get hasPublicClasses => publicClasses.isNotEmpty; - bool get hasConstants => constants.isNotEmpty; + bool get hasPublicConstants => publicConstants.isNotEmpty; - bool get hasEnums => enums.isNotEmpty; + bool get hasPublicEnums => publicEnums.isNotEmpty; - bool get hasExceptions => _allClasses.any((c) => c.isErrorOrException); + bool get hasPublicExceptions => publicExceptions.isNotEmpty; - bool get hasFunctions => functions.isNotEmpty; + bool get hasPublicFunctions => publicFunctions.isNotEmpty; - bool get hasProperties => _getVariables().any((v) => !v.isConst); + bool get hasPublicProperties => publicProperties.isNotEmpty; - bool get hasTypedefs => typedefs.isNotEmpty; + bool get hasPublicTypedefs => publicTypedefs.isNotEmpty; @override String get href { @@ -1795,8 +1991,6 @@ class Library extends ModelElement { bool get isAnonymous => element.name == null || element.name.isEmpty; - bool get isDocumented => oneLineDoc.isNotEmpty; - bool get isInSdk => _libraryElement.isInSdk; @override @@ -1807,52 +2001,53 @@ class Library extends ModelElement { @override String get name { - if (_name != null) return _name; - - // handle the case of an anonymous library - if (element.name == null || element.name.isEmpty) { - _name = _libraryElement.definingCompilationUnit.name; - if (_name.endsWith('.dart')) { - _name = _name.substring(0, _name.length - '.dart'.length); - } - } else { - _name = element.name; + if (_name == null) { + _name = getLibraryName(element); } + return _name; + } - // So, if the library is a system library, it's name is not - // dart:___, it's dart.___. Apparently the way to get to the dart:___ - // name is to get source.encoding. - // This may be wrong or misleading, but developers expect the name - // of dart:____ - var source = _libraryElement.definingCompilationUnit.source; - _name = source.isInSystemLibrary ? source.encoding : _name; + String _nameFromPath; - return _name; + /// Generate a name for this library based on its location. + /// + /// nameFromPath provides filename collision-proofing for anonymous libraries + /// by incorporating more from the location of the anonymous library into + /// the name calculation. Simple cases (such as an anonymous library in + /// 'lib') are the same, but this will include slashes and possibly colons + /// for anonymous libraries in subdirectories or other packages. + String get nameFromPath { + if (_nameFromPath == null) { + _nameFromPath = + getNameFromPath(element, package.context, package.packageMeta); + } + return _nameFromPath; } /// The real package, as opposed to the package we are documenting it with, /// [Package.name] String get packageName { if (_packageName == null) { - String sourcePath = _libraryElement.source.fullName; - File file = new File(sourcePath); - if (file.existsSync()) { - _packageName = _getPackageName(file.parent); - if (_packageName == null) _packageName = ''; - } else { - _packageName = ''; - } + _packageName = packageMeta?.name ?? ''; } - return _packageName; } + /// The real packageMeta, as opposed to the package we are documenting with. + PackageMeta _packageMeta; + PackageMeta get packageMeta { + if (_packageMeta == null) { + _packageMeta = getPackageMeta(element); + } + return _packageMeta; + } + String get path => _libraryElement.definingCompilationUnit.name; List _properties; /// All variables ("properties") except constants. - List get properties { + Iterable get properties { if (_properties == null) { _properties = _getVariables().where((v) => !v.isConst).toList(growable: false); @@ -1860,6 +2055,9 @@ class Library extends ModelElement { return _properties; } + Iterable get publicProperties => + filterNonPublic(properties); + List get typedefs { if (_typeDefs != null) return _typeDefs; @@ -1872,7 +2070,6 @@ class Library extends ModelElement { elements.addAll(_exportedNamespace.definedNames.values .where((element) => element is FunctionTypeAliasElement)); - elements..removeWhere(hasPrivateName); _typeDefs = elements .map((e) => new ModelElement.from(e, this)) .toList(growable: false) @@ -1881,6 +2078,8 @@ class Library extends ModelElement { return _typeDefs; } + Iterable get publicTypedefs => filterNonPublic(typedefs); + List get _allClasses { if (_classes != null) return _classes; @@ -1900,7 +2099,6 @@ class Library extends ModelElement { _classes = types .map((e) => new ModelElement.from(e, this)) - .where((e) => e.isPublic) .toList(growable: false) ..sort(byName); @@ -1948,36 +2146,86 @@ class Library extends ModelElement { setter = new ModelElement.from(element.setter, this); ModelElement me = new ModelElement.from(element, this, getter: getter, setter: setter); - if (me.isPublic) _variables.add(me); + _variables.add(me); } _variables.sort(byName); return _variables; } - static String getLibraryName(LibraryElement element) { - String name = element.name; - - if (name == null || name.isEmpty) { - name = element.definingCompilationUnit.name; + /// Reverses URIs if needed to get a package URI. + /// Not the same as [Package.name] because there we always strip all + /// path components; this function only strips the package prefix if the + /// library is part of the default package. + static String getNameFromPath(LibraryElement element, AnalysisContext context, + PackageMeta defaultPackage) { + String name; + if (element.source.uri.toString().startsWith('dart:')) { + name = element.source.uri.toString(); + } else { + name = context.sourceFactory.restoreUri(element.source).toString(); + } + if (name.startsWith('file:')) { + // restoreUri doesn't do anything for the package we're documenting. + String canonicalPackagePath = + '${p.canonicalize(defaultPackage.dir.path)}${p.separator}lib${p.separator}'; + String canonicalElementPath = + p.canonicalize(element.source.uri.toFilePath()); + assert(canonicalElementPath.startsWith(canonicalPackagePath)); + List pathSegments = [defaultPackage.name]..addAll( + p.split(canonicalElementPath.replaceFirst(canonicalPackagePath, ''))); + Uri libraryUri = new Uri( + scheme: 'package', + pathSegments: pathSegments, + ); + name = libraryUri.toString(); + } + + String defaultPackagePrefix = 'package:$defaultPackage/'; + if (name.startsWith(defaultPackagePrefix)) { + name = name.substring(defaultPackagePrefix.length, name.length); + } + if (name.endsWith('.dart')) { name = name.substring(0, name.length - '.dart'.length); } - + assert(!name.startsWith('file:')); return name; } - static String _getPackageName(Directory dir) { - if (!dir.existsSync() || !dir.path.contains(Platform.pathSeparator)) { - return null; + static PackageMeta getPackageMeta(LibraryElement element) { + String sourcePath = element.source.fullName; + File file = new File(p.canonicalize(sourcePath)); + Directory dir = file.parent; + while (dir.parent.path != dir.path && dir.existsSync()) { + File pubspec = new File(p.join(dir.path, 'pubspec.yaml')); + if (pubspec.existsSync()) { + return new PackageMeta.fromDir(dir); + } + dir = dir.parent; } + return null; + } - File pubspec = new File(p.join(dir.path, 'pubspec.yaml')); - if (pubspec.existsSync()) { - PackageMeta meta = new PackageMeta.fromDir(dir); - return meta.name; - } else { - return _getPackageName(dir.parent); + static String getLibraryName(LibraryElement element) { + String name = element.name; + if (name == null || name.isEmpty) { + // handle the case of an anonymous library + name = element.definingCompilationUnit.name; + + if (name.endsWith('.dart')) { + name = name.substring(0, name.length - '.dart'.length); + } } + + // So, if the library is a system library, it's name is not + // dart:___, it's dart.___. Apparently the way to get to the dart:___ + // name is to get source.encoding. + // This may be wrong or misleading, but developers expect the name + // of dart:____ + var source = element.definingCompilationUnit.source; + name = source.isInSystemLibrary ? source.encoding : name; + + return name; } Map> _modelElementsMap; @@ -2068,20 +2316,21 @@ class Library extends ModelElement { } class Method extends ModelElement - with SourceCodeMixin, Inheritable + with SourceCodeMixin, Inheritable, TypeParameters implements EnclosedElement { bool _isInherited = false; Class _enclosingClass; + @override List typeParameters = []; - Method(MethodElement element, Library library) : super(element, library) { - _modelType = new ElementType(_method.type, this); + Method(MethodElement element, Library library) + : super(element, library, null) { _calcTypeParameters(); } - Method.inherited(MethodElement element, this._enclosingClass, Library library) - : super(element, library) { - _modelType = new ElementType(_method.type, this); + Method.inherited(MethodElement element, this._enclosingClass, Library library, + {Member originalMember}) + : super(element, library, originalMember) { _isInherited = true; _calcTypeParameters(); } @@ -2135,27 +2384,14 @@ class Method extends ModelElement String get linkedReturnType => modelType.createLinkedReturnTypeName(); - @override - String get nameWithGenerics { - if (typeParameters.isEmpty) return name; - return '$name<${typeParameters.map((t) => t.name).join(', ')}>'; - } - - @override - String get genericParameters { - if (typeParameters.isEmpty) return ''; - return '<${typeParameters.map((t) => t.name).join(', ')}>'; - } - @override Method get overriddenElement { ClassElement parent = element.enclosingElement; - for (InterfaceType t in getAllSupertypes(parent)) { + for (InterfaceType t in parent.allSupertypes) { Element e = t.getMethod(element.name); if (e != null) { assert(e.enclosingElement is ClassElement); - Library l = _findOrCreateEnclosingLibraryFor(e.enclosingElement); - return new ModelElement.from(e, l); + return new ModelElement.fromElement(e, package); } } return null; @@ -2171,8 +2407,8 @@ class Method extends ModelElement class ScoredCandidate implements Comparable { final List reasons = []; - /// The ModelElement being scored. - final ModelElement element; + /// The canonicalization element being scored. + final Canonicalization element; final Library library; /// The score accumulated so far. Higher means it is more likely that this @@ -2191,7 +2427,7 @@ class ScoredCandidate implements Comparable { @override int compareTo(ScoredCandidate other) { - assert(element == other.element); + //assert(element == other.element); return score.compareTo(other.score); } @@ -2207,15 +2443,13 @@ ModelElement resolveMultiplyInheritedElement( MultiplyInheritedExecutableElement e, Library library, Class enclosingClass) { - Iterable inheritables = e.inheritedElements.map((ee) => - new ModelElement.from( - ee, library.package.findOrCreateLibraryFor(ee.library)) - as Inheritable); + Iterable inheritables = e.inheritedElements.map( + (ee) => new ModelElement.fromElement(ee, library.package) as Inheritable); Inheritable foundInheritable; - int lowIndex = enclosingClass.inheritanceAndInterfaces.length; + int lowIndex = enclosingClass.inheritanceChain.length; for (var inheritable in inheritables) { - int index = enclosingClass.inheritanceAndInterfaces - .indexOf(inheritable.enclosingElement); + int index = + enclosingClass.inheritanceChain.indexOf(inheritable.enclosingElement); if (index < lowIndex) { foundInheritable = inheritable; lowIndex = index; @@ -2225,6 +2459,11 @@ ModelElement resolveMultiplyInheritedElement( enclosingClass: enclosingClass); } +/// Classes implementing this have a public/private distinction. +abstract class Privacy { + bool get isPublic; +} + /// This class is the foundation of Dartdoc's model for source code. /// All ModelElements are contained within a [Package], and laid out in a /// structure that mirrors the availability of identifiers in the various @@ -2251,10 +2490,12 @@ ModelElement resolveMultiplyInheritedElement( /// helps prevent subtle bugs as generated output for a non-canonical /// ModelElement will reference itself as part of the "wrong" [Library] /// from the public interface perspective. -abstract class ModelElement extends Nameable - with Warnable +abstract class ModelElement extends Canonicalization + with Privacy, Warnable, Nameable implements Comparable, Documentable { final Element _element; + // TODO(jcollins-g): This really wants a "member that has a type" class. + final Member _originalMember; final Library _library; ElementType _modelType; @@ -2269,7 +2510,12 @@ abstract class ModelElement extends Nameable // WARNING: putting anything into the body of this seems // to lead to stack overflows. Need to make a registry of ModelElements // somehow. - ModelElement(this._element, this._library); + ModelElement(this._element, this._library, this._originalMember) {} + + factory ModelElement.fromElement(Element e, Package p) { + Library lib = _findOrCreateEnclosingLibraryForStatic(e, p); + return new ModelElement.from(e, lib, package: p); + } // TODO(jcollins-g): this way of using the optional parameter is messy, // clean that up. @@ -2282,9 +2528,17 @@ abstract class ModelElement extends Nameable /// 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}) { + {Class enclosingClass, + Accessor getter, + Accessor setter, + Package package}) { + Member originalMember; + // TODO(jcollins-g): Refactor object model to instantiate 'ModelMembers' + // for members? if (e is Member) { - e = Package.getBasestElement(e); + var basest = Package.getBasestElement(e); + originalMember = e; + e = basest; } Tuple3 key = new Tuple3(e, library, enclosingClass); @@ -2295,7 +2549,7 @@ abstract class ModelElement extends Nameable assert(newModelElement.element is! MultiplyInheritedExecutableElement); } else { if (e.kind == ElementKind.DYNAMIC) { - newModelElement = new Dynamic(e, library); + newModelElement = new Dynamic(e, library, package); } if (e is MultiplyInheritedExecutableElement) { newModelElement = @@ -2308,11 +2562,18 @@ abstract class ModelElement extends Nameable if (e is ClassElement) { if (!e.isEnum) { newModelElement = new Class(e, library); - if (newModelElement.library.name == 'dart:core' && - newModelElement.name == 'Object') { + if (newModelElement.name == 'Object' && + newModelElement.library.name == 'dart:core') { // We've found Object. This is an important object, so save it in the package. + assert(newModelElement.library.package._objectElement == null); newModelElement.library.package._objectElement = newModelElement; } + if (newModelElement.name == 'Interceptor' && + newModelElement.library.name == 'dart:_interceptors') { + // We've found Interceptor. Another important object. + assert(!newModelElement.library.package._interceptorUsed); + newModelElement.library.package.interceptor = newModelElement; + } } else { newModelElement = new Enum(e, library); } @@ -2361,14 +2622,15 @@ abstract class ModelElement extends Nameable if (enclosingClass == null) newModelElement = new Operator(e, library); else - newModelElement = - new Operator.inherited(e, enclosingClass, library); + newModelElement = new Operator.inherited(e, enclosingClass, library, + originalMember: originalMember); } if (e is MethodElement && !e.isOperator) { if (enclosingClass == null) newModelElement = new Method(e, library); else - newModelElement = new Method.inherited(e, enclosingClass, library); + newModelElement = new Method.inherited(e, enclosingClass, library, + originalMember: originalMember); } if (e is TopLevelVariableElement) { if (getter == null && setter == null) { @@ -2387,24 +2649,28 @@ abstract class ModelElement extends Nameable if (enclosingClass == null) newModelElement = new InheritableAccessor(e, library); else - newModelElement = - new InheritableAccessor.inherited(e, library, enclosingClass); + newModelElement = new InheritableAccessor.inherited( + e, library, enclosingClass, + originalMember: originalMember); } else { - newModelElement = new Accessor(e, library); + newModelElement = new Accessor(e, library, null); } } if (e is TypeParameterElement) { newModelElement = new TypeParameter(e, library); } if (e is ParameterElement) { - newModelElement = new Parameter(e, library); + newModelElement = + new Parameter(e, library, originalMember: originalMember); } } } if (newModelElement == null) throw "Unknown type ${e.runtimeType}"; if (enclosingClass != null) assert(newModelElement is Inheritable); - if (library != null) { + // TODO(jcollins-g): Reenable Parameter caching when dart-lang/sdk#30146 + // is fixed? + if (library != null && newModelElement is! Parameter) { library.package._allConstructedModelElements[key] = newModelElement; if (newModelElement is Inheritable) { Tuple2 iKey = new Tuple2(e, library); @@ -2414,8 +2680,8 @@ abstract class ModelElement extends Nameable } } if (newModelElement is GetterSetterCombo) { - assert(getter == null || newModelElement.getter.enclosingCombo != null); - assert(setter == null || newModelElement.setter.enclosingCombo != null); + assert(getter == null || newModelElement?.getter?.enclosingCombo != null); + assert(setter == null || newModelElement?.setter?.enclosingCombo != null); } assert(newModelElement.element is! MultiplyInheritedExecutableElement); @@ -2426,54 +2692,6 @@ abstract class ModelElement extends Nameable return library.package.libraryElementReexportedBy[this.element.library]; } - // Use components of this element's location to return a score for library - // location. - ScoredCandidate scoreElementWithLibrary(Library lib) { - ScoredCandidate scoredCandidate = new ScoredCandidate(this, lib); - Iterable resplit(Set items) sync* { - for (String item in items) { - for (String subItem in item.split('_')) { - yield subItem; - } - } - } - - // Large boost for @canonicalFor, essentially overriding all other concerns. - if (lib.canonicalFor.contains(fullyQualifiedName)) { - scoredCandidate.alterScore(5.0, 'marked @canonicalFor'); - } - // Penalty for deprecated libraries. - if (lib.isDeprecated) scoredCandidate.alterScore(-1.0, 'is deprecated'); - // Give a big boost if the library has the package name embedded in it. - if (package.namePieces.intersection(lib.namePieces).length > 0) { - scoredCandidate.alterScore(1.0, 'embeds package name'); - } - // Give a tiny boost for libraries with long names, assuming they're - // more specific (and therefore more likely to be the owner of this symbol). - scoredCandidate.alterScore(.01 * lib.namePieces.length, 'name is long'); - // If we don't know the location of this element, return our best guess. - // TODO(jcollins-g): is that even possible? - assert(!locationPieces.isEmpty); - if (locationPieces.isEmpty) return scoredCandidate; - // The more pieces we have of the location in our library name, the more we should boost our score. - scoredCandidate.alterScore( - lib.namePieces.intersection(locationPieces).length.toDouble() / - locationPieces.length.toDouble(), - 'element location shares parts with name'); - // If pieces of location at least start with elements of our library name, boost the score a little bit. - double scoreBoost = 0.0; - for (String piece in resplit(locationPieces)) { - for (String namePiece in lib.namePieces) { - if (piece.startsWith(namePiece)) { - scoreBoost += 0.001; - } - } - } - scoredCandidate.alterScore( - scoreBoost, 'element location parts start with parts of name'); - return scoredCandidate; - } - // TODO(jcollins-g): annotations should now be able to use the utility // functions in package for finding elements and avoid using computeNode(). List get annotations { @@ -2512,14 +2730,25 @@ abstract class ModelElement extends Nameable } bool _isPublic; + @override bool get isPublic { if (_isPublic == null) { - String docComment = computeDocumentationComment; - if (docComment == null) { - _isPublic = hasPublicName(element); + if (name == '') { + _isPublic = false; + } else if (this is! Library && (library == null || !library.isPublic)) { + _isPublic = false; + } else if (enclosingElement is Class && + !(enclosingElement as Class).isPublic) { + _isPublic = false; } else { - _isPublic = hasPublicName(element) && - !(docComment.contains('@nodoc') || docComment.contains('')); + String docComment = computeDocumentationComment; + if (docComment == null) { + _isPublic = hasPublicName(element); + } else { + _isPublic = hasPublicName(element) && + !(docComment.contains('@nodoc') || + docComment.contains('')); + } } } return _isPublic; @@ -2615,7 +2844,7 @@ abstract class ModelElement extends Nameable /// Returns the docs, stripped of their leading comments syntax. @override String get documentation { - return documentationFrom.map((e) => e._documentationLocal).join('\n'); + return documentationFrom.map((e) => e._documentationLocal).join('

'); } Library get definingLibrary => package.findOrCreateLibraryFor(element); @@ -2624,23 +2853,31 @@ abstract class ModelElement extends Nameable // _canonicalLibrary can be null so we can't check against null to see whether // we tried to compute it before. bool _canonicalLibraryIsSet = false; + @override Library get canonicalLibrary { - // This is not accurate if we are constructing the Package. - assert(package.allLibrariesAdded); - // Since we're looking for a library, find the [Element] immediately - // contained by a [CompilationUnitElement] in the tree. - Element topLevelElement = element; - while (topLevelElement != null && - topLevelElement is! LibraryElement && - topLevelElement.enclosingElement is! CompilationUnitElement) { - topLevelElement = topLevelElement.enclosingElement; - } - if (!_canonicalLibraryIsSet) { - if (!package.libraries.contains(definingLibrary)) { + // This is not accurate if we are constructing the Package. + assert(package.allLibrariesAdded); + // Since we're may be looking for a library, find the [Element] immediately + // contained by a [CompilationUnitElement] in the tree. + Element topLevelElement = element; + while (topLevelElement != null && + topLevelElement.enclosingElement is! LibraryElement && + topLevelElement.enclosingElement is! CompilationUnitElement && + topLevelElement.enclosingElement != null) { + topLevelElement = topLevelElement.enclosingElement; + } + + // Privately named elements can never have a canonical library, so + // just shortcut them out. + if (!hasPublicName(element)) { + _canonicalLibrary = null; + } else if (!package.publicLibraries.contains(definingLibrary)) { List candidateLibraries = package .libraryElementReexportedBy[definingLibrary.element] + ?.where((l) => l.isPublic) ?.toList(); + if (candidateLibraries != null) { candidateLibraries = candidateLibraries.where((l) { Element lookup = (l.element as LibraryElement) @@ -2652,8 +2889,8 @@ abstract class ModelElement extends Nameable return false; }).toList(); // Start with our top-level element. - ModelElement warnable = new ModelElement.from( - topLevelElement, package.findOrCreateLibraryFor(topLevelElement)); + ModelElement warnable = + new ModelElement.fromElement(topLevelElement, package); if (candidateLibraries.length > 1) { // Heuristic scoring to determine which library a human likely // considers this element to be primarily 'from', and therefore, @@ -2683,7 +2920,9 @@ abstract class ModelElement extends Nameable _canonicalLibrary = definingLibrary; } if (this is Inheritable) { - if ((this as Inheritable).isInherited && _canonicalLibrary == null) { + if ((this as Inheritable).isInherited && + _canonicalLibrary == null && + package.publicLibraries.contains(library)) { // In the event we've inherited a field from an object that isn't directly reexported, // we may need to pretend we are canonical for this. _canonicalLibrary = library; @@ -2691,13 +2930,11 @@ abstract class ModelElement extends Nameable } _canonicalLibraryIsSet = true; } + assert(_canonicalLibrary == null || + package.publicLibraries.contains(_canonicalLibrary)); return _canonicalLibrary; } - List scoreCanonicalCandidates(List libraries) { - return libraries.map((l) => scoreElementWithLibrary(l)).toList()..sort(); - } - @override bool get isCanonical { if (library == canonicalLibrary) { @@ -2821,6 +3058,9 @@ abstract class ModelElement extends Nameable return element.metadata.any((a) => a.isDeprecated); } + @override + bool get isDocumented => isCanonical && isPublic; + bool get isExecutable => element is ExecutableElement; bool get isFinal => false; @@ -2847,7 +3087,7 @@ abstract class ModelElement extends Nameable if (_linkedName == null) { _linkedName = _calculateLinkedName(); } - return _calculateLinkedName(); + return _linkedName; } String get linkedParamsLines => linkedParams().trim(); @@ -2860,34 +3100,41 @@ abstract class ModelElement extends Nameable ElementType get modelType { if (_modelType == null) { - if (element is ExecutableElement || + // TODO(jcollins-g): Need an interface for a "member with a type" (or changed object model). + if (_originalMember != null && + (_originalMember is ExecutableMember || + _originalMember is ParameterMember)) { + dynamic originalMember = _originalMember; + _modelType = new ElementType(originalMember.type, + new ModelElement.fromElement(originalMember.type.element, package)); + } else if (element is ExecutableElement || element is FunctionTypedElement || element is ParameterElement || element is TypeDefiningElement || element is PropertyInducingElement) { - Library lib; - // TODO(jcollins-g): get rid of dynamic special casing - if (element.kind != ElementKind.DYNAMIC) { - lib = _findOrCreateEnclosingLibraryFor((element as dynamic).type.element); - } _modelType = new ElementType( - (element as dynamic).type, new ModelElement.from((element as dynamic).type.element, lib)); + (element as dynamic).type, + new ModelElement.fromElement( + (element as dynamic).type.element, package)); } } return _modelType; } - @override String get name => element.name; - String get nameWithGenerics => name; - - String get genericParameters => ''; - + String _oneLineDoc; @override - String get oneLineDoc => - '${_documentation.asOneLiner}${extendedDocLink.isEmpty ? "" : " $extendedDocLink"}'; + String get oneLineDoc { + if (_oneLineDoc == null) { + _oneLineDoc = + '${_documentation.asOneLiner}${extendedDocLink.isEmpty ? "" : " $extendedDocLink"}'; + } + return _oneLineDoc; + } + + Member get originalMember => _originalMember; ModelElement get overriddenElement => null; @@ -2928,6 +3175,9 @@ abstract class ModelElement extends Nameable Package get package => (this is Library) ? (this as Library).package : this.library.package; + bool get isPublicAndPackageDocumented => + isPublic && library.package.packageDocumentedFor(this); + List _allParameters; // TODO(jcollins-g): This is in the wrong place. Move parts to GetterSetterCombo, // elsewhere as appropriate? @@ -2961,18 +3211,29 @@ abstract class ModelElement extends Nameable throw new StateError("$element cannot have parameters"); } - if (_parameters != null) return _parameters; + if (_parameters == null) { + List params; - List params; + if (element is ExecutableElement) { + if (_originalMember != null) { + assert(_originalMember is ExecutableMember); + params = (_originalMember as ExecutableMember).parameters; + } else { + params = (element as ExecutableElement).parameters; + } + } + if (params == null && element is FunctionTypedElement) { + if (_originalMember != null) { + params = (_originalMember as dynamic).parameters; + } else { + params = (element as FunctionTypedElement).parameters; + } + } - if (element is FunctionTypedElement) { - params = (element as FunctionTypedElement).parameters; + _parameters = new UnmodifiableListView(params + .map((p) => new ModelElement.from(p, library)) + .toList() as Iterable); } - - _parameters = new UnmodifiableListView(params - .map((p) => new ModelElement.from(p, library)) - .toList() as Iterable); - return _parameters; } @@ -3029,6 +3290,8 @@ abstract class ModelElement extends Nameable buf.write('${returnTypeName}'); if (showNames) { buf.write(' ${param.name}'); + } else if (param.modelType.element is ModelFunction) { + buf.write(' Function'); } if (!isTypedef) { buf.write('('); @@ -3160,14 +3423,14 @@ abstract class ModelElement extends Nameable // element associated with a ModelElement or there's an analysis bug. assert(!name.isEmpty || (this.element is TypeDefiningElement && - (this.element as TypeDefiningElement).type.name == "dynamic")); - - if (!isPublic) { - return HTML_ESCAPE.convert(name); - } + (this.element as TypeDefiningElement).type.name == "dynamic") || + (this is ModelFunction && + element.enclosingElement is ParameterElement)); if (href == null) { - warn(PackageWarning.noCanonicalFound); + if (isPublicAndPackageDocumented) { + warn(PackageWarning.noCanonicalFound); + } return HTML_ESCAPE.convert(name); } @@ -3175,11 +3438,11 @@ abstract class ModelElement extends Nameable return '$name'; } - // TODO(keertip): consolidate all the find library methods // This differs from package.findOrCreateLibraryFor in a small way, // searching for the [Library] associated with this element's enclosing // Library before trying to create one. - Library _findOrCreateEnclosingLibraryFor(Element e) { + static Library _findOrCreateEnclosingLibraryForStatic( + Element e, Package package) { var element = e.getAncestor((l) => l is LibraryElement); var lib; if (element != null) { @@ -3188,6 +3451,9 @@ abstract class ModelElement extends Nameable if (lib == null) { lib = package.findOrCreateLibraryFor(e); } + if (lib == null) { + assert(e.kind == ElementKind.DYNAMIC); + } return lib; } @@ -3353,6 +3619,9 @@ class ModelFunctionAnonymous extends ModelFunctionTyped { @override String get name => 'Function'; + @override + String get linkedName => 'Function'; + @override bool get isPublic => false; } @@ -3377,13 +3646,13 @@ class ModelFunctionTypedef extends ModelFunctionTyped { } class ModelFunctionTyped extends ModelElement - with SourceCodeMixin + with SourceCodeMixin, TypeParameters implements EnclosedElement { + @override List typeParameters = []; ModelFunctionTyped(FunctionTypedElement element, Library library) - : super(element, library) { - _modelType = new ElementType(_func.type, this); + : super(element, library, null) { _calcTypeParameters(); } @@ -3409,18 +3678,6 @@ class ModelFunctionTyped extends ModelElement String get linkedReturnType => modelType.createLinkedReturnTypeName(); - @override - String get nameWithGenerics { - if (typeParameters.isEmpty) return name; - return '$name<${typeParameters.map((t) => t.name).join(', ')}>'; - } - - @override - String get genericParameters { - if (typeParameters.isEmpty) return ''; - return '<${typeParameters.map((t) => t.name).join(', ')}>'; - } - // Food for mustache. TODO(jcollins-g): what about enclosing elements? bool get isInherited => false; @@ -3431,8 +3688,14 @@ class ModelFunctionTyped extends ModelElement abstract class Nameable { String get name; - Set get namePieces => new Set() - ..addAll(name.split(locationSplitter).where((s) => s.isNotEmpty)); + Set _namePieces; + Set get namePieces { + if (_namePieces == null) { + _namePieces = new Set() + ..addAll(name.split(locationSplitter).where((s) => s.isNotEmpty)); + } + return _namePieces; + } } class Operator extends Method { @@ -3462,8 +3725,10 @@ class Operator extends Method { Operator(MethodElement element, Library library) : super(element, library); Operator.inherited( - MethodElement element, Class enclosingClass, Library library) - : super.inherited(element, enclosingClass, library) { + MethodElement element, Class enclosingClass, Library library, + {Member originalMember}) + : super.inherited(element, enclosingClass, library, + originalMember: originalMember) { _isInherited = true; } @@ -3493,7 +3758,9 @@ class Operator extends Method { String get typeName => 'operator'; } -class Package extends Nameable with Documentable, Warnable { +// TODO(jcollins-g): Break [Package] out into a real single-package only +// class, and a container class for a set of packages. +class Package extends Canonicalization with Nameable, Warnable { // Library objects serving as entry points for documentation. final List _libraries = []; @@ -3502,7 +3769,6 @@ class Package extends Nameable with Documentable, Warnable { // Objects to keep track of warnings. final PackageWarningOptions _packageWarningOptions; - PackageWarningCounter _packageWarningCounter; // All ModelElements constructed for this package; a superset of allModelElements. @@ -3518,14 +3784,34 @@ class Package extends Nameable with Documentable, Warnable { final PackageMeta packageMeta; + @override + Library get canonicalLibrary => null; + @override Package get package => this; + final AnalysisContext context; + final DartSdk sdk; + + Map _sdkLibrarySources; + Map get sdkLibrarySources { + if (_sdkLibrarySources == null) { + _sdkLibrarySources = new Map(); + for (SdkLibrary lib in sdk?.sdkLibraries) { + _sdkLibrarySources[sdk.mapDartUri(lib.shortName)] = lib; + } + } + return _sdkLibrarySources; + } + + @override + bool get isDocumented => true; + @override Documentable get overriddenDocumentedElement => this; @override - List get documentationFrom => [this]; + List get documentationFrom => [this]; @override Warnable get enclosingElement => null; @@ -3539,19 +3825,17 @@ class Package extends Nameable with Documentable, Warnable { bool allLibrariesAdded = false; Package(Iterable libraryElements, this.packageMeta, - this._packageWarningOptions) { + this._packageWarningOptions, this.context, + [this.sdk]) { assert(_allConstructedModelElements.isEmpty); assert(allLibraries.isEmpty); _packageWarningCounter = new PackageWarningCounter(_packageWarningOptions); libraryElements.forEach((element) { - // add only if the element should be included in the public api var lib = new Library._(element, this); - if (lib.isPublic) { - _libraries.add(lib); - allLibraries[element] = lib; - assert(!_elementToLibrary.containsKey(lib.element)); - _elementToLibrary[element] = lib; - } + _libraries.add(lib); + allLibraries[element] = lib; + assert(!_elementToLibrary.containsKey(lib.element)); + _elementToLibrary[element] = lib; }); _libraries.sort((a, b) => compareNatural(a.name, b.name)); @@ -3561,6 +3845,23 @@ class Package extends Nameable with Documentable, Warnable { }); _implementors.values.forEach((l) => l.sort()); + // Go through docs of every model element in package to prebuild the macros index + // TODO(jcollins-g): move index building into a cached-on-demand generation + // like most other bits in [Package]. + allCanonicalModelElements.forEach((m) => m.documentation); + } + + /// Returns true if there's at least one library documented in the package + /// that has the same package path as the library for the given element. + /// Usable as a cross-check for dartdoc's canonicalization to generate + /// warnings for ModelElement.isPublicAndPackageDocumented. + Set _allRootDirs; + bool packageDocumentedFor(ModelElement element) { + if (_allRootDirs == null) { + _allRootDirs = new Set() + ..addAll(libraries.map((l) => l.packageMeta?.resolvedDir)); + } + return (_allRootDirs.contains(element.library.packageMeta?.resolvedDir)); } @override @@ -3597,6 +3898,17 @@ class Package extends Nameable with Documentable, Warnable { extendedDebug: extendedDebug); } + /// Returns colon-stripped name and location of the given locatable. + static Tuple2 nameAndLocation(Locatable locatable) { + String locatableName = ''; + String locatableLocation = ''; + if (locatable != null) { + locatableName = locatable.fullyQualifiedName.replaceFirst(':', '-'); + locatableLocation = locatable.elementLocation; + } + return new Tuple2(locatableName, locatableLocation); + } + final Set> _warnAlreadySeen = new Set(); void warnOnElement(Warnable warnable, PackageWarning kind, @@ -3642,6 +3954,12 @@ class Package extends Nameable with Documentable, Warnable { if (_packageWarningCounter.hasWarning(warnable, kind, message)) { return; } + // Some kinds of warnings it is OK to drop if we're not documenting them. + if (warnable != null && + skipWarningIfNotDocumentedFor.contains(kind) && + !warnable.isDocumented) { + return; + } // Elements that are part of the Dart SDK can have colons in their FQNs. // This confuses IntelliJ and makes it so it can't link to the location // of the error in the console window, so separate out the library from @@ -3750,52 +4068,10 @@ class Package extends Nameable with Documentable, Warnable { return locatable.fullyQualifiedName.replaceFirst(':', '-'); } - static Package _withAutoIncludedDependencies( - Set libraryElements, - PackageMeta packageMeta, - PackageWarningOptions options) { - var startLength = libraryElements.length; - options.autoFlush = false; - Package package = new Package(libraryElements, packageMeta, options); - - // TODO(jcollins-g): this is inefficient; keep track of modelElements better - package.allModelElements.forEach((modelElement) { - modelElement.usedElements.forEach((used) { - if (used != null && used.modelType != null) { - final ModelElement modelTypeElement = used.modelType.element; - final library = package.findLibraryFor(modelTypeElement.element); - if (library == null && - modelTypeElement.library != null && - !hasPrivateName(modelTypeElement.library.element) && - modelTypeElement.library.canonicalLibrary == null && - !libraryElements.contains(modelTypeElement.library.element)) { - libraryElements.add(modelTypeElement.library.element); - } - } - }); - }); - - if (libraryElements.length > startLength) { - package = - _withAutoIncludedDependencies(libraryElements, packageMeta, options); - } - options.autoFlush = true; - package.flushWarnings; - return package; - } - - static Package withAutoIncludedDependencies( - Iterable libraryElements, - PackageMeta packageMeta, - PackageWarningOptions options) { - return _withAutoIncludedDependencies( - new Set()..addAll(libraryElements), packageMeta, options); - } - List get categories { Map result = {}; - for (Library library in _libraries) { + for (Library library in publicLibraries) { String name = ''; if (library.name.startsWith('dart:')) { @@ -3819,24 +4095,23 @@ class Package extends Nameable with Documentable, Warnable { return packageCategories; } - Map> _libraryElementReexportedBy; + Map> _libraryElementReexportedBy = new Map(); void _tagReexportsFor( final Library tll, final LibraryElement libraryElement) { _libraryElementReexportedBy.putIfAbsent(libraryElement, () => new Set()); _libraryElementReexportedBy[libraryElement].add(tll); for (ExportElement exportedElement in libraryElement.exports) { - if ((!_elementToLibrary.containsKey(exportedElement.library)) || - libraryElement == tll.element) { - _tagReexportsFor(tll, exportedElement.exportedLibrary); - } + _tagReexportsFor(tll, exportedElement.exportedLibrary); } } + int _lastSizeOfAllLibraries = 0; Map> get libraryElementReexportedBy { // Table must be reset if we're still in the middle of adding libraries. - if (_libraryElementReexportedBy == null || !allLibrariesAdded) { + if (allLibraries.keys.length != _lastSizeOfAllLibraries) { + _lastSizeOfAllLibraries = allLibraries.keys.length; _libraryElementReexportedBy = new Map>(); - for (Library library in libraries) { + for (Library library in publicLibraries) { _tagReexportsFor(library, library.element); } } @@ -3864,6 +4139,8 @@ class Package extends Nameable with Documentable, Warnable { // canonicalization problems, don't limit ourselves in case an href is // generated for something non-canonical. if (modelElement is Dynamic) continue; + // TODO: see [Accessor.enclosingCombo] + if (modelElement is Accessor) continue; if (modelElement.href == null) continue; hrefMap.putIfAbsent(modelElement.href, () => new Set()); hrefMap[modelElement.href].add(modelElement); @@ -3921,14 +4198,15 @@ class Package extends Nameable with Documentable, Warnable { if (c._supertype != null) { _checkAndAddClass(c._supertype.element, c); } - if (!c._interfaces.isEmpty) { - c._interfaces.forEach((t) { + if (!c.interfaces.isEmpty) { + c.interfaces.forEach((t) { _checkAndAddClass(t.element, c); }); } } List get libraries => _libraries.toList(growable: false); + Iterable get publicLibraries => filterNonPublic(libraries); bool get hasHomepage => packageMeta.homepage != null && packageMeta.homepage.isNotEmpty; @@ -3945,8 +4223,42 @@ class Package extends Nameable with Documentable, Warnable { // Written from ModelElement.from. ModelElement _objectElement; + // Return the element for "Object". - ModelElement get objectElement => _objectElement; + ModelElement get objectElement { + assert(_objectElement != null); + return _objectElement; + } + + // Don't let this be used for canonicalization before we find it. + bool _interceptorUsed = false; + Class _interceptor; + + /// Return the element for "Interceptor", a Dart implementation class intended + /// to function the same as Object. + Class get interceptor { + _interceptorUsed = true; + return _interceptor; + } + + set interceptor(Class newInterceptor) { + assert(_interceptorUsed == false); + _interceptor = newInterceptor; + } + + // Return the set of [Class]es objects should inherit through if they + // show up in the inheritance chain. Do not call before interceptorElement is + // found. Add classes here if they are similar to Interceptor in that they + // are to be ignored even when they are the implementors of [Inheritable]s, + // and the class these inherit from should instead claim implementation. + Set _inheritThrough; + Set get inheritThrough { + if (_inheritThrough == null) { + _inheritThrough = new Set(); + _inheritThrough.add(interceptor); + } + return _inheritThrough; + } String get version => packageMeta.version; @@ -3971,14 +4283,6 @@ class Package extends Nameable with Documentable, Warnable { return foundLibrary; } - /// @deprecated('Whether something is documented should be a ModelElement property') - bool isDocumented(Element element) { - // If this isn't a private element and we have a canonical Library for it, - // this element will be documented. - if (hasPrivateName(element)) return false; - return findCanonicalLibraryFor(element) != null; - } - @override String toString() => isSdk ? 'SDK' : 'Package $name'; @@ -3996,7 +4300,7 @@ class Package extends Nameable with Documentable, Warnable { return _canonicalLibraryFor[e]; } _canonicalLibraryFor[e] = null; - for (Library library in libraries) { + for (Library library in publicLibraries) { if (library.modelElementsMap.containsKey(searchElement)) { for (ModelElement modelElement in library.modelElementsMap[searchElement]) { @@ -4025,6 +4329,11 @@ class Package extends Nameable with Documentable, Warnable { ModelElement findCanonicalModelElementFor(Element e, {Class preferredClass}) { assert(allLibrariesAdded); Library lib = findCanonicalLibraryFor(e); + if (preferredClass != null) { + Class canonicalClass = + findCanonicalModelElementFor(preferredClass.element); + if (canonicalClass != null) preferredClass = canonicalClass; + } if (lib == null && preferredClass != null) { lib = findCanonicalLibraryFor(preferredClass.element); } @@ -4034,9 +4343,6 @@ class Package extends Nameable with Documentable, Warnable { // TODO(jcollins-g): The data structures should be changed to eliminate guesswork // with member elements. if (e is ClassMemberElement || e is PropertyAccessorElement) { - // Prefer Fields over Accessors. - if (e is PropertyAccessorElement) - e = (e as PropertyAccessorElement).variable; if (e is Member) e = getBasestElement(e); Set candidates = new Set(); Tuple2 iKey = new Tuple2(e, lib); @@ -4057,22 +4363,6 @@ class Package extends Nameable with Documentable, Warnable { Class canonicalClass = findCanonicalModelElementFor(e.enclosingElement); if (canonicalClass != null) { candidates.addAll(canonicalClass.allCanonicalModelElements.where((m) { - if (m.element is FieldElement) { - FieldElement fieldElement = m.element as FieldElement; - Element getter; - Element setter; - if (fieldElement.getter?.isSynthetic == true) { - getter = fieldElement.getter.variable; - } else { - getter = fieldElement.getter; - } - if (fieldElement.setter?.isSynthetic == true) { - setter = fieldElement.setter.variable; - } else { - setter = fieldElement.setter; - } - if (setter == e || getter == e) return true; - } if (m.element == e) return true; return false; })); @@ -4080,15 +4370,43 @@ class Package extends Nameable with Documentable, Warnable { Set matches = new Set() ..addAll(candidates.where((me) => me.isCanonical)); + // It's possible to find accessors but no combos. Be sure that if we + // have Accessors, we find their combos too. + if (matches.any((me) => me is Accessor)) { + List combos = matches + .where((me) => me is Accessor) + .map((a) => (a as Accessor).enclosingCombo) + .toList(); + matches.addAll(combos); + assert(combos.every((c) => c.isCanonical)); + } + // This is for situations where multiple classes may actually be canonical // for an inherited element whose defining Class is not canonical. if (matches.length > 1 && preferredClass != null) { // Search for matches inside our superchain. List superChain = - preferredClass.superChainRaw.map((et) => et.element).toList(); + preferredClass.superChain.map((et) => et.element).toList(); superChain.add(preferredClass); matches.removeWhere((me) => !superChain.contains((me as EnclosedElement).enclosingElement)); + // Assumed all matches are EnclosedElement because we've been told about a + // preferredClass. + Set enclosingElements = new Set() + ..addAll(matches + .map((me) => (me as EnclosedElement).enclosingElement as Class)); + for (Class c in superChain.reversed) { + if (enclosingElements.contains(c)) { + matches.removeWhere( + (me) => (me as EnclosedElement).enclosingElement != c); + } + if (matches.length <= 1) break; + } + } + + // Prefer a GetterSetterCombo to Accessors. + if (matches.any((me) => me is GetterSetterCombo)) { + matches.removeWhere((me) => me is Accessor); } assert(matches.length <= 1); @@ -4109,6 +4427,10 @@ class Package extends Nameable with Documentable, Warnable { modelElement = null; } } + // Prefer Fields. + if (e is PropertyAccessorElement && modelElement is Accessor) { + modelElement = (modelElement as Accessor).enclosingCombo; + } return modelElement; } @@ -4167,6 +4489,8 @@ class PackageCategory implements Comparable { List get libraries => _libraries; + Iterable get publicLibraries => filterNonPublic(libraries); + @override String toString() => name; @@ -4200,14 +4524,8 @@ class PackageCategory implements Comparable { } class Parameter extends ModelElement implements EnclosedElement { - Parameter(ParameterElement element, Library library) - : super(element, library) { - var t = _parameter.type; - _modelType = new ElementType( - t, - new ModelElement.from( - t.element, _findOrCreateEnclosingLibraryFor(t.element))); - } + Parameter(ParameterElement element, Library library, {Member originalMember}) + : super(element, library, originalMember); String get defaultValue { if (!hasDefaultValue) return null; @@ -4377,6 +4695,19 @@ abstract class SourceCodeMixin { } } +abstract class TypeParameters implements Nameable { + Element get element; + + String get nameWithGenerics => '$name$genericParameters'; + + String get genericParameters { + if (typeParameters.isEmpty) return ''; + return '<${typeParameters.map((t) => t.name).join(', ')}>'; + } + + List get typeParameters; +} + /// Top-level variables. But also picks up getters and setters? class TopLevelVariable extends ModelElement with GetterSetterCombo, SourceCodeMixin @@ -4388,7 +4719,7 @@ class TopLevelVariable extends ModelElement TopLevelVariable(TopLevelVariableElement element, Library library, this.getter, this.setter) - : super(element, library) { + : super(element, library, null) { if (getter != null) { getter.enclosingCombo = this; assert(getter.enclosingCombo != null); @@ -4402,23 +4733,15 @@ class TopLevelVariable extends ModelElement @override bool get isInherited => false; - String get constantValue { - var v = _variable.computeNode().toSource(); - if (v == null) return ''; - var string = v.substring(v.indexOf('=') + 1, v.length).trim(); - string = HTML_ESCAPE.convert(string); - return string.replaceAll(modelType.name, modelType.linkedName); - } - - String get constantValueTruncated => truncateString(constantValue, 200); - @override String get documentation { // Verify that hasSetter and hasGetterNoSetter are mutually exclusive, // to prevent displaying more or less than one summary. - Set assertCheck = new Set() - ..addAll([hasPublicSetter, hasPublicGetterNoSetter]); - assert(assertCheck.containsAll([true, false])); + if (isPublic) { + Set assertCheck = new Set() + ..addAll([hasPublicSetter, hasPublicGetterNoSetter]); + assert(assertCheck.containsAll([true, false])); + } return super.documentation; } @@ -4461,20 +4784,19 @@ class TopLevelVariable extends ModelElement } class Typedef extends ModelElement - with SourceCodeMixin + with SourceCodeMixin, TypeParameters implements EnclosedElement { Typedef(FunctionTypeAliasElement element, Library library) - : super(element, library) { - if (element.type != null) { - _modelType = new ElementType(element.type, this); - } - } + : super(element, library, null); @override ModelElement get enclosingElement => library; String get fileName => '$name.html'; + @override + String get nameWithGenerics => '$name${super.genericParameters}'; + @override String get genericParameters { if (element is GenericTypeAliasElement) { @@ -4503,25 +4825,18 @@ class Typedef extends ModelElement ? modelType.createLinkedReturnTypeName() : _typedef.returnType.name; - @override - String get nameWithGenerics { - if (!modelType.isParameterizedType || _typeParameters.isEmpty) return name; - return '$name<${_typeParameters.map((t) => t.name).join(', ')}>'; - } - FunctionTypeAliasElement get _typedef => (element as FunctionTypeAliasElement); - List get _typeParameters => _typedef.typeParameters.map((f) { + @override + List get typeParameters => _typedef.typeParameters.map((f) { return new ModelElement.from(f, library); }).toList(); } class TypeParameter extends ModelElement { TypeParameter(TypeParameterElement element, Library library) - : super(element, library) { - _modelType = new ElementType(_typeParameter.type, this); - } + : super(element, library, null); @override ModelElement get enclosingElement => @@ -4549,3 +4864,313 @@ class TypeParameter extends ModelElement { @override String toString() => element.name; } + +/// Everything you need to instantiate a Package object for documenting. +class PackageBuilder { + final bool autoIncludeDependencies; + final List excludes; + final List excludePackages; + final List includes; + final List includeExternals; + final PackageMeta packageMeta; + final Directory rootDir; + final Directory sdkDir; + final bool showWarnings; + + PackageBuilder( + this.rootDir, + this.excludes, + this.excludePackages, + this.sdkDir, + this.packageMeta, + this.includes, + this.includeExternals, + this.showWarnings, + this.autoIncludeDependencies); + + void logAnalysisErrors(Set sources) {} + + Package buildPackage() { + Set libraries = getLibraries(getFiles); + return new Package( + libraries, packageMeta, getWarningOptions(), context, sdk); + } + + DartSdk _sdk; + DartSdk get sdk { + if (_sdk == null) { + _sdk = new FolderBasedDartSdk(PhysicalResourceProvider.INSTANCE, + PhysicalResourceProvider.INSTANCE.getFolder(sdkDir.path)); + } + return _sdk; + } + + EmbedderSdk _embedderSdk; + EmbedderSdk get embedderSdk { + if (_embedderSdk == null && packageMeta.isSdk == false) { + _embedderSdk = new EmbedderSdk(PhysicalResourceProvider.INSTANCE, + new EmbedderYamlLocator(packageMap).embedderYamls); + } + return _embedderSdk; + } + + static Map> _calculatePackageMap( + fileSystem.Folder dir) { + Map> map = new Map(); + var info = package_config.findPackagesFromFile(dir.toUri()); + + for (String name in info.packages) { + Uri uri = info.asMap()[name]; + fileSystem.Resource resource = + PhysicalResourceProvider.INSTANCE.getResource(uri.toFilePath()); + if (resource is fileSystem.Folder) { + map[name] = [resource]; + } + } + + return map; + } + + Map> _packageMap; + Map> get packageMap { + if (_packageMap == null) { + fileSystem.Folder cwd = + PhysicalResourceProvider.INSTANCE.getResource(rootDir.path); + _packageMap = _calculatePackageMap(cwd); + } + return _packageMap; + } + + DartUriResolver _embedderResolver; + DartUriResolver get embedderResolver { + if (_embedderResolver == null) { + _embedderResolver = new DartUriResolver(embedderSdk); + } + return _embedderResolver; + } + + SourceFactory get sourceFactory { + List resolvers = []; + resolvers.add(new SdkExtUriResolver(packageMap)); + resolvers.add(new PackageMapUriResolver( + PhysicalResourceProvider.INSTANCE, packageMap)); + if (embedderSdk == null || embedderSdk.urlMappings.length == 0) { + // The embedder uri resolver has no mappings. Use the default Dart SDK + // uri resolver. + resolvers.add(new DartUriResolver(sdk)); + } else { + // The embedder uri resolver has mappings, use it instead of the default + // Dart SDK uri resolver. + resolvers.add(embedderResolver); + } + resolvers.add( + new fileSystem.ResourceUriResolver(PhysicalResourceProvider.INSTANCE)); + + SourceFactory sourceFactory = new SourceFactory(resolvers); + return sourceFactory; + } + + AnalysisContext _context; + AnalysisContext get context { + if (_context == null) { + // TODO(jcollins-g): fix this so it actually obeys analyzer options files. + var options = new AnalysisOptionsImpl()..enableAssertInitializer = true; + + AnalysisEngine.instance.processRequiredPlugins(); + + _context = AnalysisEngine.instance.createAnalysisContext() + ..analysisOptions = options + ..sourceFactory = sourceFactory; + } + return _context; + } + + PackageWarningOptions getWarningOptions() { + PackageWarningOptions warningOptions = new PackageWarningOptions(); + // TODO(jcollins-g): explode this into detailed command line options. + if (config != null && showWarnings) { + for (PackageWarning kind in PackageWarning.values) { + warningOptions.warn(kind); + } + } + return warningOptions; + } + + /// Return an Iterable with the sdk files we should parse. + /// Filter can be String or RegExp (technically, anything valid for + /// [String.contains]) + Iterable getSdkFilesToDocument([dynamic filter]) sync* { + for (var sdkLib in sdk.sdkLibraries) { + Source source = sdk.mapDartUri(sdkLib.shortName); + if (filter == null || source.uri.toString().contains(filter)) { + yield source.fullName; + } + } + } + + bool isExcluded(String name) => excludes.any((pattern) => name == pattern); + + /// Parse a single library at [filePath] using the current analysis context. + /// Note: [libraries] and [sources] are output parameters. Adds a libraryElement + /// only if it has a non-private name. + void processLibrary( + String filePath, Set libraries, Set sources) { + String name = filePath; + if (name.startsWith(Directory.current.path)) { + name = name.substring(Directory.current.path.length); + if (name.startsWith(Platform.pathSeparator)) name = name.substring(1); + } + logInfo('parsing ${name}...'); + JavaFile javaFile = new JavaFile(filePath).getAbsoluteFile(); + Source source = new FileBasedSource(javaFile); + + // TODO(jcollins-g): remove the manual reversal using embedderSdk when we + // upgrade to analyzer-0.30 (where DartUriResolver implements + // restoreAbsolute) + Uri uri = embedderSdk?.fromFileUri(source.uri)?.uri; + if (uri != null) { + source = new FileBasedSource(javaFile, uri); + } else { + uri = context.sourceFactory.restoreUri(source); + if (uri != null) { + source = new FileBasedSource(javaFile, uri); + } + } + // TODO(jcollins-g): Excludes can match on uri or on name. Fix that. + if (!isExcluded(source.uri.toString())) { + if (context.computeKindOf(source) == SourceKind.LIBRARY) { + LibraryElement library = context.computeLibraryElement(source); + if (!isExcluded(Library.getLibraryName(library)) && + !excludePackages.contains(Library.getPackageMeta(library)?.name)) { + libraries.add(library); + sources.add(source); + } + } + } + } + + List _parseLibraries(Set files) { + Set libraries = new Set(); + Set sources = new Set(); + files.forEach((filename) => processLibrary(filename, libraries, sources)); + // Ensure that the analysis engine performs all remaining work. + AnalysisResult result = context.performAnalysisTask(); + while (result.hasMoreWork) { + result = context.performAnalysisTask(); + } + logAnalysisErrors(sources); + return libraries.toList(); + } + + /// Given a package name, explore the directory and pull out all top level + /// library files in the "lib" directory to document. + Iterable findFilesToDocumentInPackage( + String basePackageDir, bool autoIncludeDependencies) sync* { + final String sep = p.separator; + + Set packageDirs = new Set()..add(basePackageDir); + + if (autoIncludeDependencies) { + Map info = package_config + .findPackagesFromFile( + new Uri.file(p.join(basePackageDir, 'pubspec.yaml'))) + .asMap(); + for (String packageName in info.keys) { + if (!excludes.contains(packageName)) { + packageDirs.add(p.dirname(info[packageName].toFilePath())); + } + } + } + + for (String packageDir in packageDirs) { + var packageLibDir = p.join(packageDir, 'lib'); + var packageLibSrcDir = p.join(packageLibDir, 'src'); + // To avoid analyzing package files twice, only files with paths not + // containing '/packages' will be added. The only exception is if the file + // to analyze already has a '/package' in its path. + for (var lib + in listDir(packageDir, recursive: true, listDir: _packageDirList)) { + if (lib.endsWith('.dart') && + (!lib.contains('${sep}packages${sep}') || + packageDir.contains('${sep}packages${sep}'))) { + // Only include libraries within the lib dir that are not in lib/src + if (p.isWithin(packageLibDir, lib) && + !p.isWithin(packageLibSrcDir, lib)) { + // Only add the file if it does not contain 'part of' + var contents = new File(lib).readAsStringSync(); + + if (contents.contains(newLinePartOfRegexp) || + contents.startsWith(partOfRegexp)) { + // NOOP: it's a part file + } else { + yield lib; + } + } + } + } + } + } + + Set get getFiles { + Set files = new Set(); + files.addAll(packageMeta.isSdk + ? new Set() + : findFilesToDocumentInPackage(rootDir.path, autoIncludeDependencies)); + if (packageMeta.isSdk) { + files.addAll(getSdkFilesToDocument()); + } else if (embedderSdk == null || embedderSdk.urlMappings.isEmpty) { + // Always throw in the interceptors; this library is needed for + // canonicalization assuming that the Interceptor class still exists. + files.addAll(getSdkFilesToDocument('dart:_interceptors')); + } else /* embedderSdk.urlMappings.isNotEmpty && !packageMeta.isSdk */ { + embedderSdk.urlMappings.keys.forEach((String dartUri) { + Source source = embedderSdk.mapDartUri(dartUri); + files.add(source.fullName); + }); + } + // Use the includeExternals. + for (Source source in context.librarySources) { + if (includeExternals.any((string) => source.fullName.endsWith(string))) + files.add(source.fullName); + } + return files; + } + + Set getLibraries(Set files) { + Set libraries = new Set(); + libraries.addAll(_parseLibraries(files)); + if (includes != null && includes.isNotEmpty) { + Iterable knownLibraryNames = libraries.map((l) => l.name); + Set notFound = + new Set.from(includes).difference(new Set.from(knownLibraryNames)); + if (notFound.isNotEmpty) { + throw 'Did not find: [${notFound.join(', ')}] in ' + 'known libraries: [${knownLibraryNames.join(', ')}]'; + } + libraries.removeWhere((lib) => !includes.contains(lib.name)); + } + return libraries; + } + + /// If [dir] contains both a `lib` directory and a `pubspec.yaml` file treat + /// it like a package and only return the `lib` dir. + /// + /// This ensures that packages don't have non-`lib` content documented. + static Iterable _packageDirList(Directory dir) sync* { + var entities = dir.listSync(); + + var pubspec = entities.firstWhere( + (e) => e is File && p.basename(e.path) == 'pubspec.yaml', + orElse: () => null); + + var libDir = entities.firstWhere( + (e) => e is Directory && p.basename(e.path) == 'lib', + orElse: () => null); + + if (pubspec != null && libDir != null) { + yield libDir; + } else { + yield* entities; + } + } +} diff --git a/lib/src/model_utils.dart b/lib/src/model_utils.dart index 970e7e69a4..0b8dd946a3 100644 --- a/lib/src/model_utils.dart +++ b/lib/src/model_utils.dart @@ -8,16 +8,32 @@ import 'dart:convert'; import 'dart:io'; import 'package:analyzer/dart/element/element.dart'; -import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/src/generated/engine.dart'; import 'package:analyzer/src/generated/sdk.dart'; import 'package:analyzer/src/generated/source_io.dart'; +import 'package:dartdoc/src/model.dart'; import 'config.dart'; final Map _fileContents = {}; -List getAllSupertypes(ClassElement c) => c.allSupertypes; +/// Remove elements that aren't documented. +Iterable filterNonDocumented( + Iterable maybeDocumentedItems) { + return maybeDocumentedItems.where((me) => me.isDocumented); +} + +/// Returns an iterable containing only public elements from [privacyItems]. +Iterable filterNonPublic(Iterable privacyItems) { + return privacyItems.where((me) => me.isPublic); +} + +/// Finds canonical classes for all classes in the iterable, if possible. +/// If a canonical class can not be found, returns the original class. +Iterable findCanonicalFor(Iterable classes) { + return classes.map( + (c) => c.package.findCanonicalModelElementFor(c.element) as Class ?? c); +} String getFileContentsFor(Element e) { var location = e.source.fullName; @@ -28,20 +44,14 @@ String getFileContentsFor(Element e) { return _fileContents[location]; } -Iterable getSdkLibrariesToDocument( +Iterable getRequiredSdkLibraries( DartSdk sdk, AnalysisContext context) { - var sdkApiLibs = sdk.sdkLibraries - .where((SdkLibrary sdkLib) => !sdkLib.isInternal && sdkLib.isDocumented) - .toList(); - sdkApiLibs.sort((lib1, lib2) => lib1.shortName.compareTo(lib2.shortName)); - + var requiredLibs = sdk.sdkLibraries + .where((sdkLib) => sdkLib.shortName == 'dart:_interceptors'); final Set allLibraryElements = new Set(); - - for (var sdkLib in sdkApiLibs) { + for (var sdkLib in requiredLibs) { Source source = sdk.mapDartUri(sdkLib.shortName); - LibraryElement library = context.computeLibraryElement(source); - allLibraryElements.add(library); - allLibraryElements.addAll(library.exportedLibraries); + allLibraryElements.add(context.computeLibraryElement(source)); } return allLibraryElements; } diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 6e2192d2bd..98a7d05818 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -1,7 +1,6 @@ // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. - library dartdoc.utils; String stripComments(String str) { @@ -44,10 +43,11 @@ String stripComments(String str) { String truncateString(String str, int length) { if (str != null && str.length > length) { - return str.substring(0, length) + '…'; - } else { - return str; + // Do not call this on unsanitized HTML. + assert(!str.contains("<")); + return '${str.substring(0, length)}…'; } + return str; } String pluralize(String word, int count) => count == 1 ? word : '${word}s'; diff --git a/lib/src/warnings.dart b/lib/src/warnings.dart index d2ba8401d6..f12dfcdb8a 100644 --- a/lib/src/warnings.dart +++ b/lib/src/warnings.dart @@ -83,18 +83,10 @@ final Map packageWarningText = const { }; /// Something that package warnings can be called on. -/// TODO(jcollins-g): Complete object model refactoring for #1524. -abstract class Warnable implements Locatable { +abstract class Warnable implements Canonicalization { void warn(PackageWarning warning, {String message, Iterable referredFrom}); Warnable get enclosingElement; - - Set get locationPieces { - return new Set.from(element.location - .toString() - .split(locationSplitter) - .where((s) => s.isNotEmpty)); - } } /// Something that can be located for warning purposes. @@ -105,7 +97,13 @@ abstract class Locatable { Element get element; String get elementLocation; Tuple2 get lineAndColumn; - bool get isCanonical; + + Set get locationPieces { + return new Set.from(element.location + .toString() + .split(locationSplitter) + .where((s) => s.isNotEmpty)); + } } // The kinds of warnings that can be displayed when documenting a package. @@ -124,6 +122,13 @@ enum PackageWarning { typeAsHtml, } +/// Warnings it is OK to skip if we can determine the warnable isn't documented. +/// In particular, this set should not include warnings around public/private +/// or canonicalization problems, because those can break the isDocumented() +/// check. +final Set skipWarningIfNotDocumentedFor = new Set() + ..addAll([PackageWarning.unresolvedDocReference, PackageWarning.typeAsHtml]); + class PackageWarningOptions { // PackageWarnings must be in one of _ignoreWarnings or union(_asWarnings, _asErrors) final Set ignoreWarnings = new Set(); diff --git a/lib/templates/_sidebar_for_class.html b/lib/templates/_sidebar_for_class.html index a73a5db2a1..1528106654 100644 --- a/lib/templates/_sidebar_for_class.html +++ b/lib/templates/_sidebar_for_class.html @@ -1,52 +1,52 @@

    - {{#clazz.hasConstructors}} + {{#clazz.hasPublicConstructors}}
  1. Constructors
  2. - {{#clazz.constructors}} + {{#clazz.publicConstructors}}
  3. {{shortName}}
  4. - {{/clazz.constructors}} - {{/clazz.hasConstructors}} + {{/clazz.publicConstructors}} + {{/clazz.hasPublicConstructors}} - {{#clazz.hasProperties}} -
  5. + {{#clazz.hasPublicProperties}} +
  6. Properties
  7. - {{#clazz.allInstanceProperties}} + {{#clazz.allPublicInstanceProperties}} {{{ linkedName }}} - {{/clazz.allInstanceProperties}} - {{/clazz.hasProperties}} + {{/clazz.allPublicInstanceProperties}} + {{/clazz.hasPublicProperties}} - {{#clazz.hasMethods}} -
  8. Methods
  9. - {{#clazz.allInstanceMethods}} + {{#clazz.hasPublicMethods}} +
  10. Methods
  11. + {{#clazz.allPublicInstanceMethods}} {{{ linkedName }}} - {{/clazz.allInstanceMethods}} - {{/clazz.hasMethods}} + {{/clazz.allPublicInstanceMethods}} + {{/clazz.hasPublicMethods}} - {{#clazz.hasOperators}} -
  12. Operators
  13. - {{#clazz.allOperators}} + {{#clazz.hasPublicOperators}} +
  14. Operators
  15. + {{#clazz.allPublicOperators}} {{{ linkedName }}} - {{/clazz.allOperators}} - {{/clazz.hasOperators}} + {{/clazz.allPublicOperators}} + {{/clazz.hasPublicOperators}} - {{#clazz.hasStaticProperties}} + {{#clazz.hasPublicStaticProperties}}
  16. Static properties
  17. - {{#clazz.staticProperties}} + {{#clazz.publicStaticProperties}}
  18. {{{ linkedName }}}
  19. - {{/clazz.staticProperties}} - {{/clazz.hasStaticProperties}} + {{/clazz.publicStaticProperties}} + {{/clazz.hasPublicStaticProperties}} - {{#clazz.hasStaticMethods}} + {{#clazz.hasPublicStaticMethods}}
  20. Static methods
  21. - {{#clazz.staticMethods}} + {{#clazz.publicStaticMethods}}
  22. {{{ linkedName }}}
  23. - {{/clazz.staticMethods}} - {{/clazz.hasStaticMethods}} + {{/clazz.publicStaticMethods}} + {{/clazz.hasPublicStaticMethods}} - {{#clazz.hasConstants}} + {{#clazz.hasPublicConstants}}
  24. Constants
  25. - {{#clazz.constants}} + {{#clazz.publicConstants}}
  26. {{{linkedName}}}
  27. - {{/clazz.constants}} - {{/clazz.hasConstants}} + {{/clazz.publicConstants}} + {{/clazz.hasPublicConstants}}
diff --git a/lib/templates/_sidebar_for_enum.html b/lib/templates/_sidebar_for_enum.html index f4099df318..66369b17cb 100644 --- a/lib/templates/_sidebar_for_enum.html +++ b/lib/templates/_sidebar_for_enum.html @@ -1,52 +1,52 @@
    - {{#eNum.hasConstants}} + {{#eNum.hasPublicConstants}}
  1. Constants
  2. - {{#eNum.constants}} + {{#eNum.publicConstants}}
  3. {{{linkedName}}}
  4. - {{/eNum.constants}} - {{/eNum.hasConstants}} + {{/eNum.publicConstants}} + {{/eNum.hasPublicConstants}} - {{#eNum.hasConstructors}} + {{#eNum.hasPublicConstructors}}
  5. Constructors
  6. - {{#eNum.constructors}} + {{#eNum.publicConstructors}}
  7. {{shortName}}
  8. - {{/eNum.constructors}} - {{/eNum.hasConstructors}} + {{/eNum.publicConstructors}} + {{/eNum.hasPublicConstructors}} - {{#eNum.hasProperties}} -
  9. + {{#eNum.hasPublicProperties}} +
  10. Properties
  11. - {{#eNum.allInstanceProperties}} + {{#eNum.allPublicInstanceProperties}} {{{ linkedName }}} - {{/eNum.allInstanceProperties}} - {{/eNum.hasProperties}} + {{/eNum.allPublicInstanceProperties}} + {{/eNum.hasPublicProperties}} - {{#eNum.hasMethods}} -
  12. Methods
  13. - {{#eNum.allInstanceMethods}} + {{#eNum.hasPublicMethods}} +
  14. Methods
  15. + {{#eNum.allPublicInstanceMethods}} {{{ linkedName }}} - {{/eNum.allInstanceMethods}} - {{/eNum.hasMethods}} + {{/eNum.allPublicInstanceMethods}} + {{/eNum.hasPublicMethods}} - {{#eNum.hasOperators}} -
  16. Operators
  17. - {{#eNum.allOperators}} + {{#eNum.hasPublicOperators}} +
  18. Operators
  19. + {{#eNum.allPublicOperators}} {{{ linkedName }}} - {{/eNum.allOperators}} - {{/eNum.hasOperators}} + {{/eNum.allPublicOperators}} + {{/eNum.hasPublicOperators}} - {{#eNum.hasStaticProperties}} + {{#eNum.hasPublicStaticProperties}}
  20. Static properties
  21. - {{#eNum.staticProperties}} + {{#eNum.publicStaticProperties}}
  22. {{{ linkedName }}}
  23. - {{/eNum.staticProperties}} - {{/eNum.hasStaticProperties}} + {{/eNum.publicStaticProperties}} + {{/eNum.hasPublicStaticProperties}} - {{#eNum.hasStaticMethods}} + {{#eNum.hasPublicStaticMethods}}
  24. Static methods
  25. - {{#eNum.staticMethods}} + {{#eNum.publicStaticMethods}}
  26. {{{ linkedName }}}
  27. - {{/eNum.staticMethods}} - {{/eNum.hasStaticMethods}} + {{/eNum.publicStaticMethods}} + {{/eNum.hasPublicStaticMethods}}
diff --git a/lib/templates/_sidebar_for_library.html b/lib/templates/_sidebar_for_library.html index cd7217e965..c9eea573fe 100644 --- a/lib/templates/_sidebar_for_library.html +++ b/lib/templates/_sidebar_for_library.html @@ -1,50 +1,50 @@
    - {{#library.hasClasses}} + {{#library.hasPublicClasses}}
  1. Classes
  2. - {{#library.classes}} + {{#library.publicClasses}}
  3. {{{ linkedName }}}
  4. - {{/library.classes}} - {{/library.hasClasses}} + {{/library.publicClasses}} + {{/library.hasPublicClasses}} - {{#library.hasConstants}} + {{#library.hasPublicConstants}}
  5. Constants
  6. - {{#library.constants}} + {{#library.publicConstants}}
  7. {{{ linkedName }}}
  8. - {{/library.constants}} - {{/library.hasConstants}} + {{/library.publicConstants}} + {{/library.hasPublicConstants}} - {{#library.hasProperties}} + {{#library.hasPublicProperties}}
  9. Properties
  10. - {{#library.properties}} + {{#library.publicProperties}}
  11. {{{ linkedName }}}
  12. - {{/library.properties}} - {{/library.hasProperties}} + {{/library.publicProperties}} + {{/library.hasPublicProperties}} - {{#library.hasFunctions}} + {{#library.hasPublicFunctions}}
  13. Functions
  14. - {{#library.functions}} + {{#library.publicFunctions}}
  15. {{{ linkedName }}}
  16. - {{/library.functions}} - {{/library.hasFunctions}} + {{/library.publicFunctions}} + {{/library.hasPublicFunctions}} - {{#library.hasEnums}} + {{#library.hasPublicEnums}}
  17. Enums
  18. - {{#library.enums}} + {{#library.publicEnums}}
  19. {{{ linkedName }}}
  20. - {{/library.enums}} - {{/library.hasEnums}} + {{/library.publicEnums}} + {{/library.hasPublicEnums}} - {{#library.hasTypedefs}} + {{#library.hasPublicTypedefs}}
  21. Typedefs
  22. - {{#library.typedefs}} + {{#library.publicTypedefs}}
  23. {{{ linkedName }}}
  24. - {{/library.typedefs}} - {{/library.hasTypedefs}} + {{/library.publicTypedefs}} + {{/library.hasPublicTypedefs}} - {{#library.hasExceptions}} + {{#library.hasPublicExceptions}}
  25. Exceptions
  26. - {{#library.exceptions}} + {{#library.publicExceptions}}
  27. {{{ linkedName }}}
  28. - {{/library.exceptions}} - {{/library.hasExceptions}} + {{/library.publicExceptions}} + {{/library.hasPublicExceptions}}
diff --git a/lib/templates/class.html b/lib/templates/class.html index 0cfb64caf6..240d4c04db 100644 --- a/lib/templates/class.html +++ b/lib/templates/class.html @@ -14,45 +14,45 @@
{{parent.kind}} {{parent.name}}
{{#clazz.hasModifiers}}
- {{#clazz.hasSupertype}} + {{#clazz.hasPublicSuperChainReversed}}
Inheritance
  • {{{linkedObjectType}}}
  • - {{#clazz.superChainReversed}} + {{#clazz.publicSuperChainReversed}}
  • {{{linkedName}}}
  • - {{/clazz.superChainReversed}} + {{/clazz.publicSuperChainReversed}}
  • {{{name}}}
- {{/clazz.hasSupertype}} + {{/clazz.hasPublicSuperChainReversed}} - {{#clazz.hasInterfaces}} + {{#clazz.hasPublicInterfaces}}
Implements
    - {{#clazz.interfaces}} + {{#clazz.publicInterfaces}}
  • {{{linkedName}}}
  • - {{/clazz.interfaces}} + {{/clazz.publicInterfaces}}
- {{/clazz.hasInterfaces}} + {{/clazz.hasPublicInterfaces}} - {{#clazz.hasMixins}} + {{#clazz.hasPublicMixins}}
Mixes-in
    - {{#clazz.mixins}} + {{#clazz.publicMixins}}
  • {{{linkedName}}}
  • - {{/clazz.mixins}} + {{/clazz.publicMixins}}
- {{/clazz.hasMixins}} + {{/clazz.hasPublicMixins}} - {{#clazz.hasImplementors}} + {{#clazz.hasPublicImplementors}}
Implemented by
    - {{#clazz.implementors}} + {{#clazz.publicImplementors}}
  • {{{linkedName}}}
  • - {{/clazz.implementors}} + {{/clazz.publicImplementors}}
- {{/clazz.hasImplementors}} + {{/clazz.hasPublicImplementors}} {{#clazz.hasAnnotations}}
Annotations
@@ -66,12 +66,12 @@
{{parent.kind}} {{parent.name}}
{{/clazz.hasModifiers}} - {{#clazz.hasConstructors}} + {{#clazz.hasPublicConstructors}}

Constructors

- {{#clazz.constructors}} + {{#clazz.publicConstructors}}
{{{linkedName}}}({{{ linkedParams }}})
@@ -84,79 +84,79 @@

Constructors

factory
{{/isFactory}} - {{/clazz.constructors}} + {{/clazz.publicConstructors}}
- {{/clazz.hasConstructors}} + {{/clazz.hasPublicConstructors}} - {{#clazz.hasProperties}} -
+ {{#clazz.hasPublicProperties}} +

Properties

- {{#clazz.allInstanceProperties}} + {{#clazz.allPublicInstanceProperties}} {{>property}} - {{/clazz.allInstanceProperties}} + {{/clazz.allPublicInstanceProperties}}
- {{/clazz.hasProperties}} + {{/clazz.hasPublicProperties}} - {{#clazz.hasMethods}} -
+ {{#clazz.hasPublicMethods}} +

Methods

- {{#clazz.allInstanceMethods}} + {{#clazz.allPublicInstanceMethods}} {{>callable}} - {{/clazz.allInstanceMethods}} + {{/clazz.allPublicInstanceMethods}}
- {{/clazz.hasMethods}} + {{/clazz.hasPublicMethods}} - {{#clazz.hasOperators}} -
+ {{#clazz.hasPublicOperators}} +

Operators

- {{#clazz.allOperators}} + {{#clazz.allPublicOperators}} {{>callable}} - {{/clazz.allOperators}} + {{/clazz.allPublicOperators}}
- {{/clazz.hasOperators}} + {{/clazz.hasPublicOperators}} - {{#clazz.hasStaticProperties}} + {{#clazz.hasPublicStaticProperties}}

Static Properties

- {{#clazz.staticProperties}} + {{#clazz.publicStaticProperties}} {{>property}} - {{/clazz.staticProperties}} + {{/clazz.publicStaticProperties}}
- {{/clazz.hasStaticProperties}} + {{/clazz.hasPublicStaticProperties}} - {{#clazz.hasStaticMethods}} + {{#clazz.hasPublicStaticMethods}}

Static Methods

- {{#clazz.staticMethods}} + {{#clazz.publicStaticMethods}} {{>callable}} - {{/clazz.staticMethods}} + {{/clazz.publicStaticMethods}}
- {{/clazz.hasStaticMethods}} + {{/clazz.hasPublicStaticMethods}} - {{#clazz.hasConstants}} + {{#clazz.hasPublicConstants}}

Constants

- {{#clazz.constants}} + {{#clazz.publicConstants}} {{>constant}} - {{/clazz.constants}} + {{/clazz.publicConstants}}
- {{/clazz.hasConstants}} + {{/clazz.hasPublicConstants}} diff --git a/lib/templates/enum.html b/lib/templates/enum.html index 5060dd8d63..38b24f5102 100644 --- a/lib/templates/enum.html +++ b/lib/templates/enum.html @@ -14,45 +14,45 @@
{{parent.kind}} {{parent.name}}
{{#eNum.hasModifiers}}
- {{#eNum.hasSupertype}} + {{#eNum.hasPublicSuperChainReversed}}
Inheritance
  • {{{linkedObjectType}}}
  • - {{#eNum.superChainReversed}} + {{#eNum.publicSuperChainReversed}}
  • {{{linkedName}}}
  • - {{/eNum.superChainReversed}} + {{/eNum.publicSuperChainReversed}}
  • {{{name}}}
- {{/eNum.hasSupertype}} + {{/eNum.hasPublicSuperChainReversed}} - {{#eNum.hasInterfaces}} + {{#eNum.hasPublicInterfaces}}
Implements
    - {{#eNum.interfaces}} + {{#eNum.publicInterfaces}}
  • {{{linkedName}}}
  • - {{/eNum.interfaces}} + {{/eNum.publicInterfaces}}
- {{/eNum.hasInterfaces}} + {{/eNum.hasPublicInterfaces}} - {{#eNum.hasMixins}} + {{#eNum.hasPublicMixins}}
Mixes-in
    - {{#eNum.mixins}} + {{#eNum.publicMixins}}
  • {{{linkedName}}}
  • - {{/eNum.mixins}} + {{/eNum.publicMixins}}
- {{/eNum.hasMixins}} + {{/eNum.hasPublicMixins}} - {{#eNum.hasImplementors}} + {{#eNum.hasPublicImplementors}}
Implemented by
    - {{#eNum.implementors}} + {{#eNum.publicImplementors}}
  • {{{linkedName}}}
  • - {{/eNum.implementors}} + {{/eNum.publicImplementors}}
- {{/eNum.hasImplementors}} + {{/eNum.hasPublicImplementors}} {{#eNum.hasAnnotations}}
Annotations
@@ -66,24 +66,24 @@
{{parent.kind}} {{parent.name}}
{{/eNum.hasModifiers}} - {{#eNum.hasConstants}} + {{#eNum.hasPublicConstants}}

Constants

- {{#eNum.constants}} + {{#eNum.publicConstants}} {{>constant}} - {{/eNum.constants}} + {{/eNum.publicConstants}}
- {{/eNum.hasConstants}} + {{/eNum.hasPublicConstants}} - {{#eNum.hasConstructors}} + {{#eNum.hasPublicConstructors}}

Constructors

- {{#eNum.constructors}} + {{#eNum.publicConstructors}}
{{{linkedName}}}({{{ linkedParams }}})
@@ -96,67 +96,67 @@

Constructors

factory
{{/isFactory}} - {{/eNum.constructors}} + {{/eNum.publicConstructors}}
- {{/eNum.hasConstructors}} + {{/eNum.hasPublicConstructors}} - {{#eNum.hasProperties}} -
+ {{#eNum.hasPublicProperties}} +

Properties

- {{#eNum.allInstanceProperties}} + {{#eNum.allPublicInstanceProperties}} {{>property}} - {{/eNum.allInstanceProperties}} + {{/eNum.allPublicInstanceProperties}}
- {{/eNum.hasProperties}} + {{/eNum.hasPublicProperties}} - {{#eNum.hasMethods}} -
+ {{#eNum.hasPublicMethods}} +

Methods

- {{#eNum.allInstanceMethods}} + {{#eNum.allPublicInstanceMethods}} {{>callable}} - {{/eNum.allInstanceMethods}} + {{/eNum.allPublicInstanceMethods}}
- {{/eNum.hasMethods}} + {{/eNum.hasPublicMethods}} - {{#eNum.hasOperators}} -
+ {{#eNum.hasPublicOperators}} +

Operators

- {{#eNum.allOperators}} + {{#eNum.allPublicOperators}} {{>callable}} - {{/eNum.allOperators}} + {{/eNum.allPublicOperators}}
- {{/eNum.hasOperators}} + {{/eNum.hasPublicOperators}} - {{#eNum.hasStaticProperties}} + {{#eNum.hasPublicStaticProperties}}

Static Properties

- {{#eNum.staticProperties}} + {{#eNum.publicStaticProperties}} {{>property}} - {{/eNum.staticProperties}} + {{/eNum.publicStaticProperties}}
- {{/eNum.hasStaticProperties}} + {{/eNum.hasPublicStaticProperties}} - {{#eNum.hasStaticMethods}} + {{#eNum.hasPublicStaticMethods}}

Static Methods

- {{#eNum.staticMethods}} + {{#eNum.publicStaticMethods}} {{>callable}} - {{/eNum.staticMethods}} + {{/eNum.publicStaticMethods}}
- {{/eNum.hasStaticMethods}} + {{/eNum.hasPublicStaticMethods}} diff --git a/lib/templates/index.html b/lib/templates/index.html index 4a1b6831e5..a128668c5c 100644 --- a/lib/templates/index.html +++ b/lib/templates/index.html @@ -18,9 +18,9 @@
{{self.kind}} {{self.name}}
{{^useCategories}}
  1. Libraries
  2. - {{#package.libraries}} + {{#package.publicLibraries}}
  3. {{{linkedName}}}
  4. - {{/package.libraries}} + {{/package.publicLibraries}}
{{/useCategories}} @@ -53,14 +53,14 @@

{{name}}

Libraries

- {{#package.libraries}} + {{#package.publicLibraries}}
{{{ linkedName }}}
- {{#isDocumented}}{{{ oneLineDoc }}}{{/isDocumented}} + {{{ oneLineDoc }}}
- {{/package.libraries}} + {{/package.publicLibraries}}
{{/useCategories}} diff --git a/lib/templates/library.html b/lib/templates/library.html index 635ad1ec67..12c37e4a42 100644 --- a/lib/templates/library.html +++ b/lib/templates/library.html @@ -6,9 +6,9 @@
{{parent.kind}} {{parent.name}}
    {{#package.categories}}
  1. {{name}}
  2. - {{#libraries}} + {{#publicLibraries}}
  3. {{{linkedName}}}
  4. - {{/libraries}} + {{/publicLibraries}} {{/package.categories}}
{{/useCategories}} @@ -16,9 +16,9 @@
{{parent.kind}} {{parent.name}}
{{^useCategories}}
  1. Libraries
  2. - {{#package.libraries}} + {{#package.publicLibraries}}
  3. {{{linkedName}}}
  4. - {{/package.libraries}} + {{/package.publicLibraries}}
{{/useCategories}} @@ -29,104 +29,104 @@
{{parent.kind}} {{parent.name}}
{{>documentation}} {{/library}} - {{#library.hasClasses}} + {{#library.hasPublicClasses}}

Classes

- {{#library.classes}} + {{#library.publicClasses}}
{{{linkedName}}}
{{{ oneLineDoc }}}
- {{/library.classes}} + {{/library.publicClasses}}
- {{/library.hasClasses}} + {{/library.hasPublicClasses}} - {{#library.hasConstants}} + {{#library.hasPublicConstants}}

Constants

- {{#library.constants}} + {{#library.publicConstants}} {{>constant}} - {{/library.constants}} + {{/library.publicConstants}}
- {{/library.hasConstants}} + {{/library.hasPublicConstants}} - {{#library.hasProperties}} + {{#library.hasPublicProperties}}

Properties

- {{#library.properties}} + {{#library.publicProperties}} {{>property}} - {{/library.properties}} + {{/library.publicProperties}}
- {{/library.hasProperties}} + {{/library.hasPublicProperties}} - {{#library.hasFunctions}} + {{#library.hasPublicFunctions}}

Functions

- {{#library.functions}} + {{#library.publicFunctions}} {{>callable}} - {{/library.functions}} + {{/library.publicFunctions}}
- {{/library.hasFunctions}} + {{/library.hasPublicFunctions}} - {{#library.hasEnums}} + {{#library.hasPublicEnums}}

Enums

- {{#library.enums}} + {{#library.publicEnums}}
{{{linkedName}}}
{{{ oneLineDoc }}}
- {{/library.enums}} + {{/library.publicEnums}}
- {{/library.hasEnums}} + {{/library.hasPublicEnums}} - {{#library.hasTypedefs}} + {{#library.hasPublicTypedefs}}

Typedefs

- {{#library.typedefs}} + {{#library.publicTypedefs}} {{>callable}} - {{/library.typedefs}} + {{/library.publicTypedefs}}
- {{/library.hasTypedefs}} + {{/library.hasPublicTypedefs}} - {{#library.hasExceptions}} + {{#library.hasPublicExceptions}}

Exceptions / Errors

- {{#library.exceptions}} + {{#library.publicExceptions}}
{{{linkedName}}}
{{{ oneLineDoc }}}
- {{/library.exceptions}} + {{/library.publicExceptions}}
- {{/library.hasExceptions}} + {{/library.hasPublicExceptions}} diff --git a/pubspec.lock b/pubspec.lock index 46a165396d..bf3839e454 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -234,7 +234,7 @@ packages: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.0" + version: "0.7.1" shelf_packages_handler: description: name: shelf_packages_handler @@ -350,4 +350,4 @@ packages: source: hosted version: "2.1.13" sdks: - dart: ">=1.23.0 <=2.0.0-dev.7.0" + dart: ">=1.23.0 <=2.0.0-dev.8.0" diff --git a/test/compare_output_test.dart b/test/compare_output_test.dart index 52aca140d6..f682539b93 100644 --- a/test/compare_output_test.dart +++ b/test/compare_output_test.dart @@ -56,7 +56,7 @@ void main() { 'examples', '--hide-sdk-text', '--exclude', - 'dart.async,dart.collection,dart.convert,dart.core,dart.math,dart.typed_data,meta', + 'dart.async,dart.collection,dart.convert,dart.core,dart.math,dart.typed_data,package:meta/meta.dart', '--no-include-source', '--pretty-index-json', '--output', diff --git a/test/dartdoc_test.dart b/test/dartdoc_test.dart index 9ee13e284f..faab077f97 100644 --- a/test/dartdoc_test.dart +++ b/test/dartdoc_test.dart @@ -31,8 +31,8 @@ void main() { test('generate docs for ${path.basename(testPackageDir.path)} works', () async { PackageMeta meta = new PackageMeta.fromDir(testPackageDir); - DartDoc dartdoc = - new DartDoc(testPackageDir, [], getSdkDir(), [], tempDir, meta, []); + DartDoc dartdoc = new DartDoc( + testPackageDir, [], getSdkDir(), [], tempDir, meta, [], []); DartDocResults results = await dartdoc.generateDocs(); expect(results.package, isNotNull); @@ -40,14 +40,14 @@ void main() { Package p = results.package; expect(p.name, 'test_package'); expect(p.hasDocumentationFile, isTrue); - expect(p.libraries, hasLength(10)); + expect(p.publicLibraries, hasLength(10)); }); test('generate docs for ${path.basename(testPackageBadDir.path)} fails', () async { PackageMeta meta = new PackageMeta.fromDir(testPackageBadDir); DartDoc dartdoc = new DartDoc( - testPackageBadDir, [], getSdkDir(), [], tempDir, meta, []); + testPackageBadDir, [], getSdkDir(), [], tempDir, meta, [], []); try { await dartdoc.generateDocs(); @@ -60,7 +60,7 @@ void main() { test('generate docs for a package that does not have a readme', () async { PackageMeta meta = new PackageMeta.fromDir(testPackageWithNoReadme); DartDoc dartdoc = new DartDoc( - testPackageWithNoReadme, [], getSdkDir(), [], tempDir, meta, []); + testPackageWithNoReadme, [], getSdkDir(), [], tempDir, meta, [], []); DartDocResults results = await dartdoc.generateDocs(); expect(results.package, isNotNull); @@ -69,13 +69,13 @@ void main() { expect(p.name, 'test_package_small'); expect(p.hasHomepage, isFalse); expect(p.hasDocumentationFile, isFalse); - expect(p.libraries, hasLength(1)); + expect(p.publicLibraries, hasLength(1)); }); test('generate docs including a single library', () async { PackageMeta meta = new PackageMeta.fromDir(testPackageDir); DartDoc dartdoc = new DartDoc( - testPackageDir, [], getSdkDir(), [], tempDir, meta, ['fake']); + testPackageDir, [], getSdkDir(), [], tempDir, meta, ['fake'], []); DartDocResults results = await dartdoc.generateDocs(); expect(results.package, isNotNull); @@ -86,7 +86,9 @@ void main() { expect(p.libraries, hasLength(1)); expect(p.libraries.map((lib) => lib.name), contains('fake')); }); + /* + FIXME test('generate docs excluding a single library', () async { PackageMeta meta = new PackageMeta.fromDir(testPackageDir); DartDoc dartdoc = new DartDoc( @@ -98,15 +100,16 @@ void main() { Package p = results.package; expect(p.name, 'test_package'); expect(p.hasDocumentationFile, isTrue); - expect(p.libraries, hasLength(9)); - expect(p.libraries.map((lib) => lib.name).contains('fake'), isFalse); + expect(p.publicLibraries, hasLength(9)); + expect(p.publicLibraries.map((lib) => lib.name).contains('fake'), isFalse); }); + */ test('generate docs for package with embedder yaml', () async { PackageMeta meta = new PackageMeta.fromDir(testPackageWithEmbedderYaml); if (meta.needsPubGet) meta.runPubGet(); - DartDoc dartdoc = new DartDoc( - testPackageWithEmbedderYaml, [], getSdkDir(), [], tempDir, meta, []); + DartDoc dartdoc = new DartDoc(testPackageWithEmbedderYaml, [], + getSdkDir(), [], tempDir, meta, [], []); DartDocResults results = await dartdoc.generateDocs(); expect(results.package, isNotNull); diff --git a/test/io_utils_test.dart b/test/io_utils_test.dart index 9d625c4a77..5b0548c4ca 100644 --- a/test/io_utils_test.dart +++ b/test/io_utils_test.dart @@ -4,19 +4,11 @@ library dartdoc.io_utils_test; -import 'dart:io'; - import 'package:dartdoc/src/io_utils.dart'; import 'package:test/test.dart'; void main() { group('io utils', () { - test('find files to document', () { - var files = findFilesToDocumentInPackage(Directory.current.path).toList(); - expect(files.length, 1); - expect(new File(files[0]).existsSync(), isTrue); - }); - test('converts : to -', () { expect(getFileNameFor('dart:io'), 'dart-io.html'); }); diff --git a/test/model_test.dart b/test/model_test.dart index d39a34a2b2..319697b237 100644 --- a/test/model_test.dart +++ b/test/model_test.dart @@ -8,8 +8,6 @@ import 'dart:io'; import 'package:dartdoc/dartdoc.dart'; import 'package:dartdoc/src/model.dart'; -import 'package:dartdoc/src/model_utils.dart'; -import 'package:dartdoc/src/package_meta.dart'; import 'package:dartdoc/src/warnings.dart'; import 'package:dartdoc/src/sdk.dart'; import 'package:path/path.dart' as p; @@ -30,6 +28,7 @@ void main() { Library exLibrary; Library fakeLibrary; Library twoExportsLib; + Library interceptorsLib; Package sdkAsPackage; setUpAll(() { @@ -40,11 +39,9 @@ void main() { fakeLibrary = package.libraries.firstWhere((lib) => lib.name == 'fake'); twoExportsLib = package.libraries.firstWhere((lib) => lib.name == 'two_exports'); - - sdkAsPackage = Package.withAutoIncludedDependencies( - getSdkLibrariesToDocument(utils.sdkDir, utils.analyzerHelper.context), - new PackageMeta.fromSdk(sdkDir), - new PackageWarningOptions()); + interceptorsLib = + package.libraries.firstWhere((lib) => lib.name == 'dart:_interceptors'); + sdkAsPackage = utils.testPackageSdk; }); group('Package', () { @@ -58,7 +55,8 @@ void main() { }); test('libraries', () { - expect(package.libraries, hasLength(8)); + expect(package.libraries, hasLength(9)); + expect(interceptorsLib.isPublic, isFalse); }); test('homepage', () { @@ -75,18 +73,18 @@ void main() { }); test('multiple categories, sorted default', () { - expect(ginormousPackage.categories, hasLength(2)); + expect(ginormousPackage.categories, hasLength(3)); expect(ginormousPackage.categories.first.name, equals('test_package')); }); test('multiple categories, specified sort order', () { - setConfig(categoryOrder: ['Dart Core', 'test_package']); - expect(ginormousPackage.categories, hasLength(2)); - expect(ginormousPackage.categories.first.name, equals('Dart Core')); + setConfig(categoryOrder: ['meta', 'test_package']); + expect(ginormousPackage.categories, hasLength(3)); + expect(ginormousPackage.categories.first.name, equals('meta')); }); test('is documented in library', () { - expect(package.isDocumented(exLibrary.element), isTrue); + expect(exLibrary.isDocumented, isTrue); }); test('has documentation', () { @@ -140,6 +138,31 @@ void main() { expect(utils.testPackageSmall.documentation, isNull); }); }); + + group('SDK-specific cases', () { + test('Verify Interceptor is hidden from inheritance in docs', () { + Library htmlLibrary = + sdkAsPackage.libraries.singleWhere((l) => l.name == 'dart:html'); + Class EventTarget = + htmlLibrary.allClasses.singleWhere((c) => c.name == 'EventTarget'); + Field hashCode = EventTarget.allPublicInstanceProperties + .singleWhere((f) => f.name == 'hashCode'); + Class objectModelElement = sdkAsPackage.objectElement; + // If this fails, EventTarget might have been changed to no longer + // inherit from Interceptor. If that's true, adjust test case to + // another class that does. + expect( + hashCode.inheritance.any((c) => c.name == 'Interceptor'), isTrue); + // If EventTarget really does start implementing hashCode, this will + // fail. + expect(hashCode.href, equals('dart-core/Object/hashCode.html')); + expect(hashCode.canonicalEnclosingElement, equals(objectModelElement)); + expect( + EventTarget.publicSuperChainReversed + .any((et) => et.element.name == 'Interceptor'), + isFalse); + }); + }); }); group('Library', () { @@ -152,10 +175,8 @@ void main() { Class SomeClass, SomeOtherClass, YetAnotherClass, AUnicornClass; setUp(() { - dartAsyncLib = new Library( - getSdkLibrariesToDocument(utils.sdkDir, utils.analyzerHelper.context) - .first, - sdkAsPackage); + dartAsyncLib = utils.testPackageSdk.libraries + .firstWhere((l) => l.name == 'dart:async'); anonLib = package.libraries .firstWhere((lib) => lib.name == 'anonymous_library'); @@ -218,27 +239,27 @@ void main() { }); test('has properties', () { - expect(exLibrary.hasProperties, isTrue); + expect(exLibrary.hasPublicProperties, isTrue); }); test('has constants', () { - expect(exLibrary.hasConstants, isTrue); + expect(exLibrary.hasPublicConstants, isTrue); }); test('has exceptions', () { - expect(exLibrary.hasExceptions, isTrue); + expect(exLibrary.hasPublicExceptions, isTrue); }); test('has enums', () { - expect(exLibrary.hasEnums, isTrue); + expect(exLibrary.hasPublicEnums, isTrue); }); test('has functions', () { - expect(exLibrary.hasFunctions, isTrue); + expect(exLibrary.hasPublicFunctions, isTrue); }); test('has typedefs', () { - expect(exLibrary.hasTypedefs, isTrue); + expect(exLibrary.hasPublicTypedefs, isTrue); }); test('exported class', () { @@ -655,7 +676,7 @@ void main() { Class ExtendingClass, CatString; setUp(() { - classes = exLibrary.classes; + classes = exLibrary.publicClasses.toList(); Apple = classes.firstWhere((c) => c.name == 'Apple'); B = classes.firstWhere((c) => c.name == 'B'); Cat = classes.firstWhere((c) => c.name == 'Cat'); @@ -684,7 +705,7 @@ void main() { test('a class with only inherited properties has some properties', () { expect(CatString.hasInstanceProperties, isFalse); expect(CatString.instanceProperties, isEmpty); - expect(CatString.hasProperties, isTrue); + expect(CatString.hasPublicProperties, isTrue); expect(CatString.allInstanceProperties, isNotEmpty); }); @@ -697,7 +718,7 @@ void main() { }); test('correctly finds all the classes', () { - expect(classes, hasLength(22)); + expect(classes, hasLength(28)); }); test('abstract', () { @@ -705,15 +726,15 @@ void main() { }); test('supertype', () { - expect(B.hasSupertype, isTrue); + expect(B.hasPublicSuperChainReversed, isTrue); }); test('mixins', () { - expect(Apple.mixinsRaw, hasLength(0)); + expect(Apple.mixins, hasLength(0)); }); test('mixins private', () { - expect(F.mixinsRaw, hasLength(1)); + expect(F.mixins, hasLength(1)); }); test('interfaces', () { @@ -732,11 +753,11 @@ void main() { }); test('get constructors', () { - expect(Apple.constructors, hasLength(2)); + expect(Apple.publicConstructors, hasLength(2)); }); test('get static fields', () { - expect(Apple.staticProperties, hasLength(1)); + expect(Apple.publicStaticProperties, hasLength(1)); }); test('constructors have source', () { @@ -745,35 +766,37 @@ void main() { }); test('get constants', () { - expect(Apple.constants, hasLength(1)); + expect(Apple.publicConstants, hasLength(1)); }); test('get instance fields', () { - expect(Apple.instanceProperties, hasLength(3)); + expect(Apple.publicInstanceProperties, hasLength(3)); }); test('get inherited properties, including properties of Object', () { - expect(B.inheritedProperties, hasLength(4)); + expect(B.publicInheritedProperties, hasLength(4)); }); test('get methods', () { - expect(Dog.instanceMethods, hasLength(9)); + expect(Dog.publicInstanceMethods, hasLength(9)); }); test('get operators', () { - expect(Dog.operators, hasLength(1)); - expect(Dog.operators[0].name, 'operator =='); + expect(Dog.publicOperators, hasLength(1)); + expect(Dog.publicOperators.first.name, 'operator =='); }); test('inherited methods, including from Object ', () { - expect(B.inheritedMethods, hasLength(7)); - expect(B.hasInheritedMethods, isTrue); + expect(B.publicInheritedMethods, hasLength(7)); + expect(B.hasPublicInheritedMethods, isTrue); }); test('all instance methods', () { - expect(B.allInstanceMethods, isNotEmpty); - expect(B.allInstanceMethods.length, - equals(B.instanceMethods.length + B.inheritedMethods.length)); + expect(B.allPublicInstanceMethods, isNotEmpty); + expect( + B.allPublicInstanceMethods.length, + equals(B.publicInstanceMethods.length + + B.publicInheritedMethods.length)); }); test('inherited methods exist', () { @@ -801,14 +824,15 @@ void main() { }); test('F has a single instance method', () { - expect(F.instanceMethods, hasLength(1)); - expect(F.instanceMethods.first.name, equals('methodWithGenericParam')); + expect(F.publicInstanceMethods, hasLength(1)); + expect( + F.publicInstanceMethods.first.name, equals('methodWithGenericParam')); }); test('F has many inherited methods', () { - expect(F.inheritedMethods, hasLength(12)); + expect(F.publicInheritedMethods, hasLength(12)); expect( - F.inheritedMethods.map((im) => im.name), + F.publicInheritedMethods.map((im) => im.name), equals([ 'abstractMethod', 'foo', @@ -826,13 +850,13 @@ void main() { }); test('F has zero instance properties', () { - expect(F.instanceProperties, hasLength(0)); + expect(F.publicInstanceProperties, hasLength(0)); }); test('F has a few inherited properties', () { - expect(F.inheritedProperties, hasLength(10)); + expect(F.publicInheritedProperties, hasLength(10)); expect( - F.inheritedProperties.map((ip) => ip.name), + F.publicInheritedProperties.map((ip) => ip.name), equals([ 'aFinalField', 'aGetterReturningRandomThings', @@ -848,13 +872,14 @@ void main() { }); test('SpecialList has zero instance methods', () { - expect(SpecialList.instanceMethods, hasLength(0)); + expect(SpecialList.publicInstanceMethods, hasLength(0)); }); test('SpecialList has many inherited methods', () { - expect(SpecialList.inheritedMethods, hasLength(44)); - expect(SpecialList.inheritedMethods.first.name, equals('add')); - expect(SpecialList.inheritedMethods[1].name, equals('addAll')); + expect(SpecialList.publicInheritedMethods, hasLength(44)); + expect(SpecialList.publicInheritedMethods.first.name, equals('add')); + expect(SpecialList.publicInheritedMethods.toList()[1].name, + equals('addAll')); }); test('ExtendingClass is in the right library', () { @@ -865,18 +890,26 @@ void main() { // are exported out through one library test('ExtendingClass has a super class that is also in the same library', () { + // The real implementation of BaseClass is private, but it is exported. expect(ExtendingClass.superChain.first.name, equals('BaseClass')); - expect(ExtendingClass.superChain.first.element.canonicalLibrary.name, + expect( + ExtendingClass.superChain.first.element.isCanonical, equals(false)); + expect(ExtendingClass.superChain.first.element.isPublic, equals(false)); + // And it should still show up in the publicSuperChain, because it is + // exported. + expect(ExtendingClass.publicSuperChain.first.name, equals('BaseClass')); + expect( + ExtendingClass.publicSuperChain.first.element.canonicalLibrary.name, equals('two_exports')); }); test( "ExtendingClass's super class has a library that is not in two_exports", () { - expect(ExtendingClass.superChainRaw.last.name, - equals('WithGetterAndSetter')); - expect(ExtendingClass.superChainRaw.last.element.library.name, - equals('fake')); + expect( + ExtendingClass.superChain.last.name, equals('WithGetterAndSetter')); + expect( + ExtendingClass.superChain.last.element.library.name, equals('fake')); }); }); @@ -1037,6 +1070,125 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); }); + group('Type expansion', () { + Class TemplatedInterface, ClassWithUnusualProperties; + + setUp(() { + TemplatedInterface = + exLibrary.classes.singleWhere((c) => c.name == 'TemplatedInterface'); + ClassWithUnusualProperties = fakeLibrary.classes + .singleWhere((c) => c.name == 'ClassWithUnusualProperties'); + }); + + test('setter that takes a function is correctly displayed', () { + Field explicitSetter = ClassWithUnusualProperties.instanceProperties + .singleWhere((f) => f.name == 'explicitSetter'); + // TODO(jcollins-g): really, these shouldn't be called "parameters" in + // the span class. + expect(explicitSetter.linkedReturnType, + '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>>>'); + }); + + test('parameterized type from inherited field is correctly displayed', () { + Field aInheritedField = TemplatedInterface.inheritedProperties + .singleWhere((f) => f.name == 'aInheritedField'); + expect(aInheritedField.linkedReturnType, + 'AnotherParameterizedClass<List<int>>'); + }); + + test( + 'parameterized type for return value from explicit getter is correctly displayed', + () { + Accessor aGetter = TemplatedInterface.instanceProperties + .singleWhere((f) => f.name == 'aGetter') + .getter; + expect(aGetter.linkedReturnType, + 'AnotherParameterizedClass<Map<A, List<String>>>'); + }); + + test( + 'parameterized type for return value from inherited explicit getter is correctly displayed', + () { + Accessor aInheritedGetter = TemplatedInterface.inheritedProperties + .singleWhere((f) => f.name == 'aInheritedGetter') + .getter; + expect(aInheritedGetter.linkedReturnType, + 'AnotherParameterizedClass<List<int>>'); + }); + + test( + 'parameterized type for return value from inherited explicit setter is correctly displayed', + () { + Accessor aInheritedSetter = TemplatedInterface.inheritedProperties + .singleWhere((f) => f.name == 'aInheritedSetter') + .setter; + expect(aInheritedSetter.allParameters.first.modelType.linkedName, + 'AnotherParameterizedClass<List<int>>'); + // TODO(jcollins-g): really, these shouldn't be called "parameters" in + // the span class. + expect(aInheritedSetter.enclosingCombo.linkedReturnType, + 'AnotherParameterizedClass<List<int>>'); + }); + + test( + 'parameterized type for return value from method is correctly displayed', + () { + Method aMethodInterface = TemplatedInterface.allInstanceMethods + .singleWhere((m) => m.name == 'aMethodInterface'); + expect(aMethodInterface.linkedReturnType, + 'AnotherParameterizedClass<List<int>>'); + }); + + test( + 'parameterized type for return value from inherited method is correctly displayed', + () { + Method aInheritedMethod = TemplatedInterface.allInstanceMethods + .singleWhere((m) => m.name == 'aInheritedMethod'); + expect(aInheritedMethod.linkedReturnType, + 'AnotherParameterizedClass<List<int>>'); + }); + + test( + 'parameterized type for return value containing a parameterized typedef is correctly displayed', + () { + Method aTypedefReturningMethodInterface = TemplatedInterface + .allInstanceMethods + .singleWhere((m) => m.name == 'aTypedefReturningMethodInterface'); + expect(aTypedefReturningMethodInterface.linkedReturnType, + 'ParameterizedTypedef<List<String>>'); + }); + + test( + 'parameterized type for return value containing a parameterized typedef from inherited method is correctly displayed', + () { + Method aInheritedTypedefReturningMethod = TemplatedInterface + .allInstanceMethods + .singleWhere((m) => m.name == 'aInheritedTypedefReturningMethod'); + expect(aInheritedTypedefReturningMethod.linkedReturnType, + 'ParameterizedTypedef<List<int>>'); + }); + + test('parameterized types for inherited operator is correctly displayed', + () { + Operator aInheritedAdditionOperator = TemplatedInterface + .inheritedOperators + .singleWhere((m) => m.name == 'operator +'); + expect(aInheritedAdditionOperator.linkedReturnType, + 'ParameterizedClass<List<int>>'); + expect(aInheritedAdditionOperator.linkedParams(), + 'ParameterizedClass<List<int>> other'); + }); + + test('', () {}); + }); + group('Method', () { Class classB, klass, @@ -1093,27 +1245,11 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, } }); - test('verify parameters to types are displayed', () { - var matcher = new RegExp( - 'Function\\(T. T.\\)'); - expect( - matcher.hasMatch(getAFunctionReturningVoid.linkedReturnType), isTrue); - }); - test('verify parameter types are correctly displayed', () { 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); + 'Function(T1, T2)')); }); test( @@ -1122,8 +1258,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( getAFunctionReturningBool.linkedReturnType, equals( - 'Function<T4>(String T1 T4)')); - }, skip: 'blocked on https://github.com/dart-lang/sdk/issues/30146'); + 'Function<T4>(String, T1, T4)')); + }); test('has a fully qualified name', () { expect(m1.fullyQualifiedName, 'ex.B.m1'); @@ -1374,14 +1510,16 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('@nodoc on simple property works', () { - Field simpleHidden = UnusualProperties.allModelElements - .firstWhere((e) => e.name == 'simpleHidden', orElse: () => null); + Field simpleHidden = UnusualProperties.allModelElements.firstWhere( + (e) => e.name == 'simpleHidden' && e.isPublic, + orElse: () => null); expect(simpleHidden, isNull); }); test('@nodoc on explicit getters/setters hides entire field', () { Field explicitNodocGetterSetter = UnusualProperties.allModelElements - .firstWhere((e) => e.name == 'explicitNodocGetterSetter', + .firstWhere( + (e) => e.name == 'explicitNodocGetterSetter' && e.isPublic, orElse: () => null); expect(explicitNodocGetterSetter, isNull); }); @@ -1628,14 +1766,14 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('@nodoc on simple property works', () { - TopLevelVariable nodocSimple = fakeLibrary.properties.firstWhere( + TopLevelVariable nodocSimple = fakeLibrary.publicProperties.firstWhere( (p) => p.name == 'simplePropertyHidden', orElse: () => null); expect(nodocSimple, isNull); }); test('@nodoc on both hides both', () { - TopLevelVariable nodocBoth = fakeLibrary.properties.firstWhere( + TopLevelVariable nodocBoth = fakeLibrary.publicProperties.firstWhere( (p) => p.name == 'getterSetterNodocBoth', orElse: () => null); expect(nodocBoth, isNull); @@ -1671,8 +1809,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect(v.enclosingElement.name, equals(exLibrary.name)); }); - test('found two properties', () { - expect(exLibrary.properties, hasLength(5)); + test('found five properties', () { + expect(exLibrary.publicProperties, hasLength(5)); }); test('linked return type is a double', () { @@ -1711,6 +1849,8 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, prettyColorsConstant, deprecated; + Field aStaticConstField, aName; + setUp(() { greenConstant = exLibrary.constants.firstWhere((c) => c.name == 'COLOR_GREEN'); @@ -1721,6 +1861,20 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, cat = exLibrary.constants.firstWhere((c) => c.name == 'MY_CAT'); deprecated = exLibrary.constants.firstWhere((c) => c.name == 'deprecated'); + Class Dog = exLibrary.allClasses.firstWhere((c) => c.name == 'Dog'); + aStaticConstField = + Dog.allFields.firstWhere((f) => f.name == 'aStaticConstField'); + aName = + Dog.allFields.firstWhere((f) => f.name == 'aName'); + }); + + test('substrings of the constant values type are not linked (#1535)', () { + expect(aName.constantValue, + 'const ExtendedShortName("hello there")'); + }); + + test('constant field values are escaped', () { + expect(aStaticConstField.constantValue, '"A Constant Dog"'); }); test('has a fully qualified name', () { @@ -1732,7 +1886,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('found all the constants', () { - expect(exLibrary.constants, hasLength(9)); + expect(exLibrary.publicConstants, hasLength(9)); }); test('COLOR_GREEN is constant', () { @@ -1844,12 +1998,12 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, expect( aComplexTypedef.linkedReturnType, equals( - 'Function(A1 A2 A3)')); + 'Function(A1, A2, A3)')); expect( aComplexTypedef.linkedParamsLines, equals( - 'A3 String')); - }, skip: 'blocked on https://github.com/dart-lang/sdk/issues/30146'); + 'A3, String')); + }); test('has a fully qualified name', () { expect(t.fullyQualifiedName, 'ex.processMessage'); @@ -1975,8 +2129,11 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, setUp(() { apple = exLibrary.classes.firstWhere((c) => c.name == 'Apple'); b = exLibrary.classes.firstWhere((c) => c.name == 'B'); - implA = apple.implementors; - implC = exLibrary.classes.firstWhere((c) => c.name == 'Cat').implementors; + implA = apple.publicImplementors.toList(); + implC = exLibrary.classes + .firstWhere((c) => c.name == 'Cat') + .publicImplementors + .toList(); }); test('the first class is Apple', () { @@ -1984,7 +2141,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, }); test('apple has some implementors', () { - expect(apple.hasImplementors, isTrue); + expect(apple.hasPublicImplementors, isTrue); expect(implA, isNotNull); expect(implA, hasLength(1)); expect(implA[0].name, equals('B')); @@ -2001,7 +2158,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans, test('B does not have implementors', () { expect(b, isNotNull); expect(b.name, equals('B')); - expect(b.implementors, hasLength(0)); + expect(b.publicImplementors, hasLength(0)); }); }); diff --git a/test/src/utils.dart b/test/src/utils.dart index 3a9610e9d7..8304ddc99e 100644 --- a/test/src/utils.dart +++ b/test/src/utils.dart @@ -6,26 +6,19 @@ library test_utils; import 'dart:io'; -import 'package:analyzer/dart/element/element.dart'; -import 'package:analyzer/file_system/file_system.dart'; -import 'package:analyzer/file_system/physical_file_system.dart'; -import 'package:analyzer/src/dart/sdk/sdk.dart'; -import 'package:analyzer/src/generated/engine.dart'; -import 'package:analyzer/src/generated/java_io.dart'; -import 'package:analyzer/src/generated/sdk.dart'; -import 'package:analyzer/src/generated/source_io.dart'; +import 'package:dartdoc/dartdoc.dart'; import 'package:dartdoc/src/config.dart'; import 'package:dartdoc/src/model.dart'; -import 'package:dartdoc/src/warnings.dart'; import 'package:dartdoc/src/package_meta.dart'; import 'package:dartdoc/src/sdk.dart'; import 'package:path/path.dart' as p; -AnalyzerHelper analyzerHelper; -DartSdk sdkDir; +Directory sdkDir; +PackageMeta sdkPackageMeta; Package testPackage; Package testPackageGinormous; Package testPackageSmall; +Package testPackageSdk; final Directory testPackageBadDir = new Directory('testing/test_package_bad'); final Directory testPackageDir = new Directory('testing/test_package'); @@ -39,53 +32,43 @@ void delete(Directory dir) { } void init() { - ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE; - sdkDir = new FolderBasedDartSdk( - resourceProvider, resourceProvider.getFolder(getSdkDir().path)); - + sdkDir = getSdkDir(); + sdkPackageMeta = new PackageMeta.fromSdk(sdkDir); setConfig(); - analyzerHelper = new AnalyzerHelper(); - var pathsForTestLib = [ - 'lib/example.dart', - 'lib/two_exports.dart', - 'lib/fake.dart', - 'lib/anonymous_library.dart', - 'lib/another_anonymous_lib.dart', - 'lib/is_deprecated.dart', - 'lib/reexport_one.dart', - 'lib/reexport_two.dart', - ]; - - testPackage = _bootPackage(pathsForTestLib, 'testing/test_package', false); - testPackageGinormous = - _bootPackage(pathsForTestLib, 'testing/test_package', true); + testPackage = bootBasicPackage( + 'testing/test_package', ['css', 'code_in_comments', 'excluded'], false); + testPackageGinormous = bootBasicPackage( + 'testing/test_package', ['css', 'code_in_commnets', 'excluded'], true); - testPackageSmall = - _bootPackage(['lib/main.dart'], 'testing/test_package_small', false); + testPackageSmall = bootBasicPackage('testing/test_package_small', [], false); + testPackageSdk = bootSdkPackage(); } -Package _bootPackage(Iterable libPaths, String dirPath, - bool withAutoIncludedDependencies) { - String fullDirPath = p.join(Directory.current.path, dirPath); - Iterable libElements = libPaths.map((libFile) { - Source source = analyzerHelper.addSource(p.join(fullDirPath, libFile)); - return analyzerHelper.resolve(source); - }); - - if (withAutoIncludedDependencies) { - return Package.withAutoIncludedDependencies( - libElements, - new PackageMeta.fromDir(new Directory(dirPath)), - new PackageWarningOptions()); - } else { - return new Package( - libElements, - new PackageMeta.fromDir(new Directory(dirPath)), - new PackageWarningOptions()); - } +Package bootSdkPackage() { + Directory dir = new Directory(p.current); + return new PackageBuilder( + dir, [], [], sdkDir, sdkPackageMeta, [], [], true, false) + .buildPackage(); } +Package bootBasicPackage( + String dirPath, List excludes, bool withAutoIncludedDependencies) { + Directory dir = new Directory(dirPath); + return new PackageBuilder( + dir, + excludes, + [], + sdkDir, + new PackageMeta.fromDir(new Directory(dirPath)), + [], + [], + true, + withAutoIncludedDependencies) + .buildPackage(); +} +/* +@deprecated class AnalyzerHelper { AnalysisContext context; @@ -106,9 +89,15 @@ class AnalyzerHelper { ChangeSet changeSet = new ChangeSet(); changeSet.addedSource(source); context.applyChanges(changeSet); + // Ensure that the analysis engine performs all remaining work. + AnalysisResult result = context.performAnalysisTask(); + while (result.hasMoreWork) { + result = context.performAnalysisTask(); + } return source; } LibraryElement resolve(Source librarySource) => context.computeLibraryElement(librarySource); } +*/ diff --git a/testing/test_package/lib/example.dart b/testing/test_package/lib/example.dart index fcaba19c39..31513ee9be 100644 --- a/testing/test_package/lib/example.dart +++ b/testing/test_package/lib/example.dart @@ -67,6 +67,42 @@ typedef String processMessage(String msg); typedef String ParameterizedTypedef(T msg, int foo); +/// Support class to test inheritance + type expansion from implements clause. +abstract class ParameterizedClass { + AnotherParameterizedClass aInheritedMethod(int foo); + ParameterizedTypedef aInheritedTypedefReturningMethod(); + AnotherParameterizedClass aInheritedField; + AnotherParameterizedClass get aInheritedGetter; + ParameterizedClass operator+ (ParameterizedClass other); + set aInheritedSetter(AnotherParameterizedClass thingToSet); +} + +class AnotherParameterizedClass {} + +/// Class for testing expansion of type from implements clause. +abstract class TemplatedInterface implements ParameterizedClass> { + AnotherParameterizedClass> aMethodInterface(A value); + ParameterizedTypedef> aTypedefReturningMethodInterface(); + AnotherParameterizedClass>> aField; + AnotherParameterizedClass>> get aGetter; + set aSetter(AnotherParameterizedClass> thingToSet); +} + +class TemplatedClass { + int aMethod(X input) { + return 5; + } +} + +class ShortName { + final String aParameter; + const ShortName(this.aParameter); +} + +class ExtendedShortName extends ShortName { + const ExtendedShortName(String aParameter) : super(aParameter); +} + /// Referencing [processMessage] (or other things) here should not break /// enum constants ala #1445 enum Animal { @@ -246,6 +282,9 @@ class Dog implements Cat, E { final int aFinalField; static const String aStaticConstField = "A Constant Dog"; + /// Verify link substitution in constants (#1535) + static const ShortName aName = const ExtendedShortName("hello there"); + @protected final int aProtectedFinalField; diff --git a/testing/test_package/lib/fake.dart b/testing/test_package/lib/fake.dart index 04b77690a2..fea53e3161 100644 --- a/testing/test_package/lib/fake.dart +++ b/testing/test_package/lib/fake.dart @@ -241,10 +241,10 @@ class ClassWithUnusualProperties extends ImplicitProperties { String get documentedPartialFieldInSubclassOnly => "overridden getter"; @override + /// Docs for setter of implicitGetterExplicitSetter. set implicitGetterExplicitSetter(String x) {} @override - /// Getter doc for explicitGetterImplicitSetter List get explicitGetterImplicitSetter => new List(); diff --git a/testing/test_package_docs/ex/Animal-class.html b/testing/test_package_docs/ex/Animal-class.html index 7edfb51839..355810ce8d 100644 --- a/testing/test_package_docs/ex/Animal-class.html +++ b/testing/test_package_docs/ex/Animal-class.html @@ -39,6 +39,7 @@
library ex
  1. Classes
  2. +
  3. AnotherParameterizedClass
  4. Apple
  5. aThingToDo
  6. B
  7. @@ -49,15 +50,20 @@
    library ex
  8. Deprecated
  9. Dog
  10. E
  11. +
  12. ExtendedShortName
  13. F
  14. ForAnnotation
  15. HasAnnotation
  16. Helper
  17. Klass
  18. +
  19. ParameterizedClass
  20. PublicClassExtendsPrivateClass
  21. PublicClassImplementsPrivateInterface
  22. ShapeType
  23. +
  24. ShortName
  25. SpecializedDuration
  26. +
  27. TemplatedClass
  28. +
  29. TemplatedInterface
  30. TypedFunctionsWithoutTypedefs
  31. WithGeneric
  32. WithGenericSub
  33. diff --git a/testing/test_package_docs/ex/AnotherParameterizedClass-class.html b/testing/test_package_docs/ex/AnotherParameterizedClass-class.html new file mode 100644 index 0000000000..336e490c4e --- /dev/null +++ b/testing/test_package_docs/ex/AnotherParameterizedClass-class.html @@ -0,0 +1,235 @@ + + + + + + + + AnotherParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
    + +
    + + +
    AnotherParameterizedClass
    + +
    + +
    + + + +
    + + + +
    +

    Constructors

    + +
    +
    + AnotherParameterizedClass() +
    +
    + +
    +
    +
    + +
    +

    Properties

    + +
    +
    + hashCode + → int +
    +
    + +
    read-only, inherited
    +
    +
    + runtimeType + → Type +
    +
    + +
    read-only, inherited
    +
    +
    +
    + +
    +

    Methods

    +
    +
    + noSuchMethod(Invocation invocation) + → dynamic + +
    +
    + +
    inherited
    +
    +
    + toString() + → String + +
    +
    + +
    inherited
    +
    +
    +
    + +
    +

    Operators

    +
    +
    + operator ==(other) + → bool + +
    +
    + +
    inherited
    +
    +
    +
    + + + + +
    + + + +
    + +
    + + test_package 0.0.1 + + +
    + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/AnotherParameterizedClass/AnotherParameterizedClass.html b/testing/test_package_docs/ex/AnotherParameterizedClass/AnotherParameterizedClass.html new file mode 100644 index 0000000000..2a9fb492ae --- /dev/null +++ b/testing/test_package_docs/ex/AnotherParameterizedClass/AnotherParameterizedClass.html @@ -0,0 +1,96 @@ + + + + + + + + AnotherParameterizedClass constructor - AnotherParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
    + +
    + + +
    AnotherParameterizedClass
    + +
    + +
    + + + +
    +
    + + AnotherParameterizedClass() +
    + + + + +
    + + + +
    + +
    + + test_package 0.0.1 + + +
    + + + + + + + + + + + diff --git a/testing/test_package_docs/fake/BaseThingy2/hashCode.html b/testing/test_package_docs/ex/AnotherParameterizedClass/hashCode.html similarity index 58% rename from testing/test_package_docs/fake/BaseThingy2/hashCode.html rename to testing/test_package_docs/ex/AnotherParameterizedClass/hashCode.html index 5a611bcb76..912d192c51 100644 --- a/testing/test_package_docs/fake/BaseThingy2/hashCode.html +++ b/testing/test_package_docs/ex/AnotherParameterizedClass/hashCode.html @@ -4,8 +4,8 @@ - - hashCode property - BaseThingy2 class - fake library - Dart API + + hashCode property - AnotherParameterizedClass class - ex library - Dart API @@ -24,8 +24,8 @@
    hashCode
    @@ -37,26 +37,23 @@
    diff --git a/testing/test_package_docs/ex/Dog/noSuchMethod.html b/testing/test_package_docs/ex/Dog/aName-constant.html similarity index 80% rename from testing/test_package_docs/ex/Dog/noSuchMethod.html rename to testing/test_package_docs/ex/Dog/aName-constant.html index 31cae951cc..ca94732224 100644 --- a/testing/test_package_docs/ex/Dog/noSuchMethod.html +++ b/testing/test_package_docs/ex/Dog/aName-constant.html @@ -4,8 +4,8 @@ - - noSuchMethod method - Dog class - ex library - Dart API + + aName constant - Dog class - ex library - Dart API @@ -26,9 +26,9 @@
  34. test_package
  35. ex
  36. Dog
  37. -
  38. method noSuchMethod
  39. +
  40. constant aName
-
noSuchMethod
+
aName
@@ -54,8 +54,8 @@
class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,22 +81,28 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • - +
    +
    - dynamic - noSuchMethod(Invocation invocation) + ShortName + aName = + const ExtendedShortName("hello there")
    - - + +
    +

    Verify link substitution in constants (#1535)

    +
    +
    diff --git a/testing/test_package_docs/ex/Dog/aProtectedFinalField.html b/testing/test_package_docs/ex/Dog/aProtectedFinalField.html index 3a4dd10e7a..4d391dc41a 100644 --- a/testing/test_package_docs/ex/Dog/aProtectedFinalField.html +++ b/testing/test_package_docs/ex/Dog/aProtectedFinalField.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/aStaticConstField-constant.html b/testing/test_package_docs/ex/Dog/aStaticConstField-constant.html index e16ff05581..7862dfaf02 100644 --- a/testing/test_package_docs/ex/Dog/aStaticConstField-constant.html +++ b/testing/test_package_docs/ex/Dog/aStaticConstField-constant.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • @@ -90,7 +91,7 @@
    class Dog
    String aStaticConstField = - "A Constant Dog" + "A Constant Dog"
    diff --git a/testing/test_package_docs/ex/Dog/abstractMethod.html b/testing/test_package_docs/ex/Dog/abstractMethod.html index a05747511d..65cda5b2cc 100644 --- a/testing/test_package_docs/ex/Dog/abstractMethod.html +++ b/testing/test_package_docs/ex/Dog/abstractMethod.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/createDog.html b/testing/test_package_docs/ex/Dog/createDog.html index 5c9589979f..3f40bc1acc 100644 --- a/testing/test_package_docs/ex/Dog/createDog.html +++ b/testing/test_package_docs/ex/Dog/createDog.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/deprecatedField.html b/testing/test_package_docs/ex/Dog/deprecatedField.html index 4d4fd698df..852bd4eac9 100644 --- a/testing/test_package_docs/ex/Dog/deprecatedField.html +++ b/testing/test_package_docs/ex/Dog/deprecatedField.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/deprecatedGetter.html b/testing/test_package_docs/ex/Dog/deprecatedGetter.html index ee27beb87e..6f612b19c7 100644 --- a/testing/test_package_docs/ex/Dog/deprecatedGetter.html +++ b/testing/test_package_docs/ex/Dog/deprecatedGetter.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/deprecatedSetter.html b/testing/test_package_docs/ex/Dog/deprecatedSetter.html index 30508d1bc4..1abe465b9b 100644 --- a/testing/test_package_docs/ex/Dog/deprecatedSetter.html +++ b/testing/test_package_docs/ex/Dog/deprecatedSetter.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/foo.html b/testing/test_package_docs/ex/Dog/foo.html index dff7456084..682db4c7cc 100644 --- a/testing/test_package_docs/ex/Dog/foo.html +++ b/testing/test_package_docs/ex/Dog/foo.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/getAnotherClassD.html b/testing/test_package_docs/ex/Dog/getAnotherClassD.html index 54da12ceb1..a325da8cd5 100644 --- a/testing/test_package_docs/ex/Dog/getAnotherClassD.html +++ b/testing/test_package_docs/ex/Dog/getAnotherClassD.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/getClassA.html b/testing/test_package_docs/ex/Dog/getClassA.html index 7a97450521..d5060a52ac 100644 --- a/testing/test_package_docs/ex/Dog/getClassA.html +++ b/testing/test_package_docs/ex/Dog/getClassA.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/hashCode.html b/testing/test_package_docs/ex/Dog/hashCode.html deleted file mode 100644 index 5582be020d..0000000000 --- a/testing/test_package_docs/ex/Dog/hashCode.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - hashCode property - Dog class - ex library - Dart API - - - - - - - - - - - - -
    - -
    - - -
    hashCode
    - -
    - -
    - - - -
    - -
    - -
    - int - hashCode
    inherited
    -
    - - -
    - -
    - - - -
    - -
    - - test_package 0.0.1 - - -
    - - - - - - - - - - - diff --git a/testing/test_package_docs/ex/Dog/isImplemented.html b/testing/test_package_docs/ex/Dog/isImplemented.html index 408f996a51..49ceee66e5 100644 --- a/testing/test_package_docs/ex/Dog/isImplemented.html +++ b/testing/test_package_docs/ex/Dog/isImplemented.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/name.html b/testing/test_package_docs/ex/Dog/name.html index b3a9665cf8..73e73d286f 100644 --- a/testing/test_package_docs/ex/Dog/name.html +++ b/testing/test_package_docs/ex/Dog/name.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/operator_equals.html b/testing/test_package_docs/ex/Dog/operator_equals.html index a493a09e7f..19193ae86c 100644 --- a/testing/test_package_docs/ex/Dog/operator_equals.html +++ b/testing/test_package_docs/ex/Dog/operator_equals.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/runtimeType.html b/testing/test_package_docs/ex/Dog/runtimeType.html deleted file mode 100644 index 529d65f4ca..0000000000 --- a/testing/test_package_docs/ex/Dog/runtimeType.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - runtimeType property - Dog class - ex library - Dart API - - - - - - - - - - - - -
    - -
    - - -
    runtimeType
    - -
    - -
    - - - -
    - -
    - -
    - Type - runtimeType
    inherited
    -
    - - -
    - -
    - - - -
    - -
    - - test_package 0.0.1 - - -
    - - - - - - - - - - - diff --git a/testing/test_package_docs/ex/Dog/somethingTasty.html b/testing/test_package_docs/ex/Dog/somethingTasty.html index f8a3df9722..cf3b7956d3 100644 --- a/testing/test_package_docs/ex/Dog/somethingTasty.html +++ b/testing/test_package_docs/ex/Dog/somethingTasty.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/staticGetterSetter.html b/testing/test_package_docs/ex/Dog/staticGetterSetter.html index f2c5898ffc..8e0f94cd00 100644 --- a/testing/test_package_docs/ex/Dog/staticGetterSetter.html +++ b/testing/test_package_docs/ex/Dog/staticGetterSetter.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/testGeneric.html b/testing/test_package_docs/ex/Dog/testGeneric.html index c2f1048eb4..1ab9bfc2ec 100644 --- a/testing/test_package_docs/ex/Dog/testGeneric.html +++ b/testing/test_package_docs/ex/Dog/testGeneric.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/testGenericMethod.html b/testing/test_package_docs/ex/Dog/testGenericMethod.html index b2629cf44c..6e69480fe2 100644 --- a/testing/test_package_docs/ex/Dog/testGenericMethod.html +++ b/testing/test_package_docs/ex/Dog/testGenericMethod.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/testMethod.html b/testing/test_package_docs/ex/Dog/testMethod.html index 9e2e3c1a1f..a664861bfd 100644 --- a/testing/test_package_docs/ex/Dog/testMethod.html +++ b/testing/test_package_docs/ex/Dog/testMethod.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/toString.html b/testing/test_package_docs/ex/Dog/toString.html deleted file mode 100644 index d71042c1cd..0000000000 --- a/testing/test_package_docs/ex/Dog/toString.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - toString method - Dog class - ex library - Dart API - - - - - - - - - - - - -
    - -
    - - -
    toString
    - -
    - -
    - - - -
    -
    - String - toString() -
    - - - -
    - - - -
    - -
    - - test_package 0.0.1 - - -
    - - - - - - - - - - - diff --git a/testing/test_package_docs/ex/Dog/withMacro.html b/testing/test_package_docs/ex/Dog/withMacro.html index 43d1132f28..df3db133ef 100644 --- a/testing/test_package_docs/ex/Dog/withMacro.html +++ b/testing/test_package_docs/ex/Dog/withMacro.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/Dog/withMacro2.html b/testing/test_package_docs/ex/Dog/withMacro2.html index 43df8b9ded..cc85f23653 100644 --- a/testing/test_package_docs/ex/Dog/withMacro2.html +++ b/testing/test_package_docs/ex/Dog/withMacro2.html @@ -54,8 +54,8 @@
    class Dog
  • deprecatedSetter
  • isImplemented
  • name
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • abstractMethod
  • @@ -67,8 +67,8 @@
    class Dog
  • testMethod
  • withMacro
  • withMacro2
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator ==
  • @@ -81,6 +81,7 @@
    class Dog
  • createDog
  • Constants
  • +
  • aName
  • aStaticConstField
  • diff --git a/testing/test_package_docs/ex/E-class.html b/testing/test_package_docs/ex/E-class.html index 29f3c30eb6..ec948eed61 100644 --- a/testing/test_package_docs/ex/E-class.html +++ b/testing/test_package_docs/ex/E-class.html @@ -39,6 +39,7 @@
    library ex
    1. Classes
    2. +
    3. AnotherParameterizedClass
    4. Apple
    5. aThingToDo
    6. B
    7. @@ -49,15 +50,20 @@
      library ex
    8. Deprecated
    9. Dog
    10. E
    11. +
    12. ExtendedShortName
    13. F
    14. ForAnnotation
    15. HasAnnotation
    16. Helper
    17. Klass
    18. +
    19. ParameterizedClass
    20. PublicClassExtendsPrivateClass
    21. PublicClassImplementsPrivateInterface
    22. ShapeType
    23. +
    24. ShortName
    25. SpecializedDuration
    26. +
    27. TemplatedClass
    28. +
    29. TemplatedInterface
    30. TypedFunctionsWithoutTypedefs
    31. WithGeneric
    32. WithGenericSub
    33. diff --git a/testing/test_package_docs/ex/ExtendedShortName-class.html b/testing/test_package_docs/ex/ExtendedShortName-class.html new file mode 100644 index 0000000000..cace833572 --- /dev/null +++ b/testing/test_package_docs/ex/ExtendedShortName-class.html @@ -0,0 +1,259 @@ + + + + + + + + ExtendedShortName class - ex library - Dart API + + + + + + + + + + + + +
      + +
      + + +
      ExtendedShortName
      + +
      + +
      + + + +
      + + +
      +
      +
      Inheritance
      +
      + + + + +
      +
      + +
      +

      Constructors

      + +
      +
      + ExtendedShortName(String aParameter) +
      +
      + +
      const
      +
      +
      +
      + +
      +

      Properties

      + +
      +
      + aParameter + → String +
      +
      + +
      final, inherited
      +
      +
      + hashCode + → int +
      +
      + +
      read-only, inherited
      +
      +
      + runtimeType + → Type +
      +
      + +
      read-only, inherited
      +
      +
      +
      + +
      +

      Methods

      +
      +
      + noSuchMethod(Invocation invocation) + → dynamic + +
      +
      + +
      inherited
      +
      +
      + toString() + → String + +
      +
      + +
      inherited
      +
      +
      +
      + +
      +

      Operators

      +
      +
      + operator ==(other) + → bool + +
      +
      + +
      inherited
      +
      +
      +
      + + + + +
      + + + +
      + +
      + + test_package 0.0.1 + + +
      + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/ExtendedShortName/ExtendedShortName.html b/testing/test_package_docs/ex/ExtendedShortName/ExtendedShortName.html new file mode 100644 index 0000000000..9c2f395e0e --- /dev/null +++ b/testing/test_package_docs/ex/ExtendedShortName/ExtendedShortName.html @@ -0,0 +1,97 @@ + + + + + + + + ExtendedShortName constructor - ExtendedShortName class - ex library - Dart API + + + + + + + + + + + + +
      + +
      + + +
      ExtendedShortName
      + +
      + +
      + + + +
      +
      + const + ExtendedShortName(String aParameter) +
      + + + + +
      + + + +
      + +
      + + test_package 0.0.1 + + +
      + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/F-class.html b/testing/test_package_docs/ex/F-class.html index 0d4828e636..e42b7795f4 100644 --- a/testing/test_package_docs/ex/F-class.html +++ b/testing/test_package_docs/ex/F-class.html @@ -39,6 +39,7 @@
      library ex
      1. Classes
      2. +
      3. AnotherParameterizedClass
      4. Apple
      5. aThingToDo
      6. B
      7. @@ -49,15 +50,20 @@
        library ex
      8. Deprecated
      9. Dog
      10. E
      11. +
      12. ExtendedShortName
      13. F
      14. ForAnnotation
      15. HasAnnotation
      16. Helper
      17. Klass
      18. +
      19. ParameterizedClass
      20. PublicClassExtendsPrivateClass
      21. PublicClassImplementsPrivateInterface
      22. ShapeType
      23. +
      24. ShortName
      25. SpecializedDuration
      26. +
      27. TemplatedClass
      28. +
      29. TemplatedInterface
      30. TypedFunctionsWithoutTypedefs
      31. WithGeneric
      32. WithGenericSub
      33. @@ -184,7 +190,7 @@

        Properties

        write-only, inherited
        - hashCode + hashCode → int
        @@ -208,7 +214,7 @@

        Properties

        read / write, inherited
        - runtimeType + runtimeType → Type
        @@ -267,7 +273,7 @@

        Methods

        inherited
        - noSuchMethod(Invocation invocation) + noSuchMethod(Invocation invocation) → dynamic
        @@ -312,7 +318,7 @@

        Methods

        inherited
        - toString() + toString() → String
        @@ -376,10 +382,10 @@
        class F
      34. deprecatedField
      35. deprecatedGetter
      36. deprecatedSetter
      37. -
      38. hashCode
      39. +
      40. hashCode
      41. isImplemented
      42. name
      43. -
      44. runtimeType
      45. +
      46. runtimeType
      47. Methods
      48. methodWithGenericParam
      49. @@ -387,12 +393,12 @@
        class F
      50. foo
      51. getAnotherClassD
      52. getClassA
      53. -
      54. noSuchMethod
      55. +
      56. noSuchMethod
      57. test
      58. testGeneric
      59. testGenericMethod
      60. testMethod
      61. -
      62. toString
      63. +
      64. toString
      65. withMacro
      66. withMacro2
      67. diff --git a/testing/test_package_docs/ex/F/F.html b/testing/test_package_docs/ex/F/F.html index a06609c14c..cb0bcbc919 100644 --- a/testing/test_package_docs/ex/F/F.html +++ b/testing/test_package_docs/ex/F/F.html @@ -51,10 +51,10 @@
        class F
      68. deprecatedField
      69. deprecatedGetter
      70. deprecatedSetter
      71. -
      72. hashCode
      73. +
      74. hashCode
      75. isImplemented
      76. name
      77. -
      78. runtimeType
      79. +
      80. runtimeType
      81. Methods
      82. methodWithGenericParam
      83. @@ -62,12 +62,12 @@
        class F
      84. foo
      85. getAnotherClassD
      86. getClassA
      87. -
      88. noSuchMethod
      89. +
      90. noSuchMethod
      91. test
      92. testGeneric
      93. testGenericMethod
      94. testMethod
      95. -
      96. toString
      97. +
      98. toString
      99. withMacro
      100. withMacro2
      101. diff --git a/testing/test_package_docs/ex/F/methodWithGenericParam.html b/testing/test_package_docs/ex/F/methodWithGenericParam.html index c14cb06bf1..9272573b68 100644 --- a/testing/test_package_docs/ex/F/methodWithGenericParam.html +++ b/testing/test_package_docs/ex/F/methodWithGenericParam.html @@ -51,10 +51,10 @@
        class F
      102. deprecatedField
      103. deprecatedGetter
      104. deprecatedSetter
      105. -
      106. hashCode
      107. +
      108. hashCode
      109. isImplemented
      110. name
      111. -
      112. runtimeType
      113. +
      114. runtimeType
      115. Methods
      116. methodWithGenericParam
      117. @@ -62,12 +62,12 @@
        class F
      118. foo
      119. getAnotherClassD
      120. getClassA
      121. -
      122. noSuchMethod
      123. +
      124. noSuchMethod
      125. test
      126. testGeneric
      127. testGenericMethod
      128. testMethod
      129. -
      130. toString
      131. +
      132. toString
      133. withMacro
      134. withMacro2
      135. diff --git a/testing/test_package_docs/ex/F/test.html b/testing/test_package_docs/ex/F/test.html index b8a1020eec..55a7082247 100644 --- a/testing/test_package_docs/ex/F/test.html +++ b/testing/test_package_docs/ex/F/test.html @@ -51,10 +51,10 @@
        class F
      136. deprecatedField
      137. deprecatedGetter
      138. deprecatedSetter
      139. -
      140. hashCode
      141. +
      142. hashCode
      143. isImplemented
      144. name
      145. -
      146. runtimeType
      147. +
      148. runtimeType
      149. Methods
      150. methodWithGenericParam
      151. @@ -62,12 +62,12 @@
        class F
      152. foo
      153. getAnotherClassD
      154. getClassA
      155. -
      156. noSuchMethod
      157. +
      158. noSuchMethod
      159. test
      160. testGeneric
      161. testGenericMethod
      162. testMethod
      163. -
      164. toString
      165. +
      166. toString
      167. withMacro
      168. withMacro2
      169. diff --git a/testing/test_package_docs/ex/ForAnnotation-class.html b/testing/test_package_docs/ex/ForAnnotation-class.html index c00f7532d3..bbcde34722 100644 --- a/testing/test_package_docs/ex/ForAnnotation-class.html +++ b/testing/test_package_docs/ex/ForAnnotation-class.html @@ -39,6 +39,7 @@
        library ex
        1. Classes
        2. +
        3. AnotherParameterizedClass
        4. Apple
        5. aThingToDo
        6. B
        7. @@ -49,15 +50,20 @@
          library ex
        8. Deprecated
        9. Dog
        10. E
        11. +
        12. ExtendedShortName
        13. F
        14. ForAnnotation
        15. HasAnnotation
        16. Helper
        17. Klass
        18. +
        19. ParameterizedClass
        20. PublicClassExtendsPrivateClass
        21. PublicClassImplementsPrivateInterface
        22. ShapeType
        23. +
        24. ShortName
        25. SpecializedDuration
        26. +
        27. TemplatedClass
        28. +
        29. TemplatedInterface
        30. TypedFunctionsWithoutTypedefs
        31. WithGeneric
        32. WithGenericSub
        33. diff --git a/testing/test_package_docs/ex/HasAnnotation-class.html b/testing/test_package_docs/ex/HasAnnotation-class.html index 3ae2b07b3f..0997a35a5a 100644 --- a/testing/test_package_docs/ex/HasAnnotation-class.html +++ b/testing/test_package_docs/ex/HasAnnotation-class.html @@ -39,6 +39,7 @@
          library ex
          1. Classes
          2. +
          3. AnotherParameterizedClass
          4. Apple
          5. aThingToDo
          6. B
          7. @@ -49,15 +50,20 @@
            library ex
          8. Deprecated
          9. Dog
          10. E
          11. +
          12. ExtendedShortName
          13. F
          14. ForAnnotation
          15. HasAnnotation
          16. Helper
          17. Klass
          18. +
          19. ParameterizedClass
          20. PublicClassExtendsPrivateClass
          21. PublicClassImplementsPrivateInterface
          22. ShapeType
          23. +
          24. ShortName
          25. SpecializedDuration
          26. +
          27. TemplatedClass
          28. +
          29. TemplatedInterface
          30. TypedFunctionsWithoutTypedefs
          31. WithGeneric
          32. WithGenericSub
          33. diff --git a/testing/test_package_docs/ex/Helper-class.html b/testing/test_package_docs/ex/Helper-class.html index 4407bd7474..cdb046177d 100644 --- a/testing/test_package_docs/ex/Helper-class.html +++ b/testing/test_package_docs/ex/Helper-class.html @@ -39,6 +39,7 @@
            library ex
            1. Classes
            2. +
            3. AnotherParameterizedClass
            4. Apple
            5. aThingToDo
            6. B
            7. @@ -49,15 +50,20 @@
              library ex
            8. Deprecated
            9. Dog
            10. E
            11. +
            12. ExtendedShortName
            13. F
            14. ForAnnotation
            15. HasAnnotation
            16. Helper
            17. Klass
            18. +
            19. ParameterizedClass
            20. PublicClassExtendsPrivateClass
            21. PublicClassImplementsPrivateInterface
            22. ShapeType
            23. +
            24. ShortName
            25. SpecializedDuration
            26. +
            27. TemplatedClass
            28. +
            29. TemplatedInterface
            30. TypedFunctionsWithoutTypedefs
            31. WithGeneric
            32. WithGenericSub
            33. diff --git a/testing/test_package_docs/ex/Klass-class.html b/testing/test_package_docs/ex/Klass-class.html index a42a627942..c4237ec796 100644 --- a/testing/test_package_docs/ex/Klass-class.html +++ b/testing/test_package_docs/ex/Klass-class.html @@ -39,6 +39,7 @@
              library ex
              1. Classes
              2. +
              3. AnotherParameterizedClass
              4. Apple
              5. aThingToDo
              6. B
              7. @@ -49,15 +50,20 @@
                library ex
              8. Deprecated
              9. Dog
              10. E
              11. +
              12. ExtendedShortName
              13. F
              14. ForAnnotation
              15. HasAnnotation
              16. Helper
              17. Klass
              18. +
              19. ParameterizedClass
              20. PublicClassExtendsPrivateClass
              21. PublicClassImplementsPrivateInterface
              22. ShapeType
              23. +
              24. ShortName
              25. SpecializedDuration
              26. +
              27. TemplatedClass
              28. +
              29. TemplatedInterface
              30. TypedFunctionsWithoutTypedefs
              31. WithGeneric
              32. WithGenericSub
              33. diff --git a/testing/test_package_docs/ex/MY_CAT-constant.html b/testing/test_package_docs/ex/MY_CAT-constant.html index 80b2db7e9e..ff7dd35b62 100644 --- a/testing/test_package_docs/ex/MY_CAT-constant.html +++ b/testing/test_package_docs/ex/MY_CAT-constant.html @@ -39,6 +39,7 @@
                library ex
                1. Classes
                2. +
                3. AnotherParameterizedClass
                4. Apple
                5. aThingToDo
                6. B
                7. @@ -49,15 +50,20 @@
                  library ex
                8. Deprecated
                9. Dog
                10. E
                11. +
                12. ExtendedShortName
                13. F
                14. ForAnnotation
                15. HasAnnotation
                16. Helper
                17. Klass
                18. +
                19. ParameterizedClass
                20. PublicClassExtendsPrivateClass
                21. PublicClassImplementsPrivateInterface
                22. ShapeType
                23. +
                24. ShortName
                25. SpecializedDuration
                26. +
                27. TemplatedClass
                28. +
                29. TemplatedInterface
                30. TypedFunctionsWithoutTypedefs
                31. WithGeneric
                32. WithGenericSub
                33. diff --git a/testing/test_package_docs/ex/MyError-class.html b/testing/test_package_docs/ex/MyError-class.html index c6f2f43fdd..6a5a64e326 100644 --- a/testing/test_package_docs/ex/MyError-class.html +++ b/testing/test_package_docs/ex/MyError-class.html @@ -39,6 +39,7 @@
                  library ex
                  1. Classes
                  2. +
                  3. AnotherParameterizedClass
                  4. Apple
                  5. aThingToDo
                  6. B
                  7. @@ -49,15 +50,20 @@
                    library ex
                  8. Deprecated
                  9. Dog
                  10. E
                  11. +
                  12. ExtendedShortName
                  13. F
                  14. ForAnnotation
                  15. HasAnnotation
                  16. Helper
                  17. Klass
                  18. +
                  19. ParameterizedClass
                  20. PublicClassExtendsPrivateClass
                  21. PublicClassImplementsPrivateInterface
                  22. ShapeType
                  23. +
                  24. ShortName
                  25. SpecializedDuration
                  26. +
                  27. TemplatedClass
                  28. +
                  29. TemplatedInterface
                  30. TypedFunctionsWithoutTypedefs
                  31. WithGeneric
                  32. WithGenericSub
                  33. diff --git a/testing/test_package_docs/ex/MyErrorImplements-class.html b/testing/test_package_docs/ex/MyErrorImplements-class.html index 0ccaacecb5..8333aaa7d1 100644 --- a/testing/test_package_docs/ex/MyErrorImplements-class.html +++ b/testing/test_package_docs/ex/MyErrorImplements-class.html @@ -39,6 +39,7 @@
                    library ex
                    1. Classes
                    2. +
                    3. AnotherParameterizedClass
                    4. Apple
                    5. aThingToDo
                    6. B
                    7. @@ -49,15 +50,20 @@
                      library ex
                    8. Deprecated
                    9. Dog
                    10. E
                    11. +
                    12. ExtendedShortName
                    13. F
                    14. ForAnnotation
                    15. HasAnnotation
                    16. Helper
                    17. Klass
                    18. +
                    19. ParameterizedClass
                    20. PublicClassExtendsPrivateClass
                    21. PublicClassImplementsPrivateInterface
                    22. ShapeType
                    23. +
                    24. ShortName
                    25. SpecializedDuration
                    26. +
                    27. TemplatedClass
                    28. +
                    29. TemplatedInterface
                    30. TypedFunctionsWithoutTypedefs
                    31. WithGeneric
                    32. WithGenericSub
                    33. diff --git a/testing/test_package_docs/ex/MyException-class.html b/testing/test_package_docs/ex/MyException-class.html index fbf2ce4a69..3d77ba8800 100644 --- a/testing/test_package_docs/ex/MyException-class.html +++ b/testing/test_package_docs/ex/MyException-class.html @@ -39,6 +39,7 @@
                      library ex
                      1. Classes
                      2. +
                      3. AnotherParameterizedClass
                      4. Apple
                      5. aThingToDo
                      6. B
                      7. @@ -49,15 +50,20 @@
                        library ex
                      8. Deprecated
                      9. Dog
                      10. E
                      11. +
                      12. ExtendedShortName
                      13. F
                      14. ForAnnotation
                      15. HasAnnotation
                      16. Helper
                      17. Klass
                      18. +
                      19. ParameterizedClass
                      20. PublicClassExtendsPrivateClass
                      21. PublicClassImplementsPrivateInterface
                      22. ShapeType
                      23. +
                      24. ShortName
                      25. SpecializedDuration
                      26. +
                      27. TemplatedClass
                      28. +
                      29. TemplatedInterface
                      30. TypedFunctionsWithoutTypedefs
                      31. WithGeneric
                      32. WithGenericSub
                      33. diff --git a/testing/test_package_docs/ex/MyExceptionImplements-class.html b/testing/test_package_docs/ex/MyExceptionImplements-class.html index 92db033811..a554570ea8 100644 --- a/testing/test_package_docs/ex/MyExceptionImplements-class.html +++ b/testing/test_package_docs/ex/MyExceptionImplements-class.html @@ -39,6 +39,7 @@
                        library ex
                        1. Classes
                        2. +
                        3. AnotherParameterizedClass
                        4. Apple
                        5. aThingToDo
                        6. B
                        7. @@ -49,15 +50,20 @@
                          library ex
                        8. Deprecated
                        9. Dog
                        10. E
                        11. +
                        12. ExtendedShortName
                        13. F
                        14. ForAnnotation
                        15. HasAnnotation
                        16. Helper
                        17. Klass
                        18. +
                        19. ParameterizedClass
                        20. PublicClassExtendsPrivateClass
                        21. PublicClassImplementsPrivateInterface
                        22. ShapeType
                        23. +
                        24. ShortName
                        25. SpecializedDuration
                        26. +
                        27. TemplatedClass
                        28. +
                        29. TemplatedInterface
                        30. TypedFunctionsWithoutTypedefs
                        31. WithGeneric
                        32. WithGenericSub
                        33. diff --git a/testing/test_package_docs/ex/PRETTY_COLORS-constant.html b/testing/test_package_docs/ex/PRETTY_COLORS-constant.html index d2f7e4a87b..494420e677 100644 --- a/testing/test_package_docs/ex/PRETTY_COLORS-constant.html +++ b/testing/test_package_docs/ex/PRETTY_COLORS-constant.html @@ -39,6 +39,7 @@
                          library ex
                          1. Classes
                          2. +
                          3. AnotherParameterizedClass
                          4. Apple
                          5. aThingToDo
                          6. B
                          7. @@ -49,15 +50,20 @@
                            library ex
                          8. Deprecated
                          9. Dog
                          10. E
                          11. +
                          12. ExtendedShortName
                          13. F
                          14. ForAnnotation
                          15. HasAnnotation
                          16. Helper
                          17. Klass
                          18. +
                          19. ParameterizedClass
                          20. PublicClassExtendsPrivateClass
                          21. PublicClassImplementsPrivateInterface
                          22. ShapeType
                          23. +
                          24. ShortName
                          25. SpecializedDuration
                          26. +
                          27. TemplatedClass
                          28. +
                          29. TemplatedInterface
                          30. TypedFunctionsWithoutTypedefs
                          31. WithGeneric
                          32. WithGenericSub
                          33. diff --git a/testing/test_package_docs/ex/ParameterizedClass-class.html b/testing/test_package_docs/ex/ParameterizedClass-class.html new file mode 100644 index 0000000000..f93796ef2f --- /dev/null +++ b/testing/test_package_docs/ex/ParameterizedClass-class.html @@ -0,0 +1,307 @@ + + + + + + + + ParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
                            + +
                            + + +
                            ParameterizedClass
                            + +
                            + +
                            + + + +
                            + +
                            +

                            Support class to test inheritance + type expansion from implements clause.

                            +
                            + +
                            +
                            + + + +
                            Implemented by
                            +
                            + +
                            +
                            + +
                            +

                            Constructors

                            + +
                            +
                            + ParameterizedClass() +
                            +
                            + +
                            +
                            +
                            + +
                            +

                            Properties

                            + +
                            +
                            + aInheritedField + AnotherParameterizedClass<T> +
                            +
                            + +
                            read / write
                            +
                            +
                            + aInheritedGetter + AnotherParameterizedClass<T> +
                            +
                            + +
                            read-only
                            +
                            +
                            + aInheritedSetter + AnotherParameterizedClass<T> +
                            +
                            + +
                            write-only
                            +
                            +
                            + hashCode + → int +
                            +
                            + +
                            read-only, inherited
                            +
                            +
                            + runtimeType + → Type +
                            +
                            + +
                            read-only, inherited
                            +
                            +
                            +
                            + +
                            +

                            Methods

                            +
                            +
                            + aInheritedMethod(int foo) + AnotherParameterizedClass<T> + +
                            +
                            + + +
                            +
                            + aInheritedTypedefReturningMethod() + ParameterizedTypedef<T> + +
                            +
                            + + +
                            +
                            + noSuchMethod(Invocation invocation) + → dynamic + +
                            +
                            + +
                            inherited
                            +
                            +
                            + toString() + → String + +
                            +
                            + +
                            inherited
                            +
                            +
                            +
                            + +
                            +

                            Operators

                            +
                            +
                            + operator +(ParameterizedClass<T> other) + ParameterizedClass<T> + +
                            +
                            + + +
                            +
                            + operator ==(other) + → bool + +
                            +
                            + +
                            inherited
                            +
                            +
                            +
                            + + + + +
                            + + + +
                            + +
                            + + test_package 0.0.1 + + +
                            + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/ParameterizedClass/ParameterizedClass.html b/testing/test_package_docs/ex/ParameterizedClass/ParameterizedClass.html new file mode 100644 index 0000000000..f0ef438f25 --- /dev/null +++ b/testing/test_package_docs/ex/ParameterizedClass/ParameterizedClass.html @@ -0,0 +1,102 @@ + + + + + + + + ParameterizedClass constructor - ParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
                            + +
                            + + +
                            ParameterizedClass
                            + +
                            + +
                            + + + +
                            +
                            + + ParameterizedClass() +
                            + + + + +
                            + + + +
                            + +
                            + + test_package 0.0.1 + + +
                            + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/ParameterizedClass/aInheritedField.html b/testing/test_package_docs/ex/ParameterizedClass/aInheritedField.html new file mode 100644 index 0000000000..206a9cf71b --- /dev/null +++ b/testing/test_package_docs/ex/ParameterizedClass/aInheritedField.html @@ -0,0 +1,100 @@ + + + + + + + + aInheritedField property - ParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
                            + +
                            + + +
                            aInheritedField
                            + +
                            + +
                            + + + +
                            +
                            + AnotherParameterizedClass<T> + aInheritedField
                            read / write
                            +
                            + + +
                            + + + +
                            + +
                            + + test_package 0.0.1 + + +
                            + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/ParameterizedClass/aInheritedGetter.html b/testing/test_package_docs/ex/ParameterizedClass/aInheritedGetter.html new file mode 100644 index 0000000000..3eab5c42e7 --- /dev/null +++ b/testing/test_package_docs/ex/ParameterizedClass/aInheritedGetter.html @@ -0,0 +1,105 @@ + + + + + + + + aInheritedGetter property - ParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
                            + +
                            + + +
                            aInheritedGetter
                            + +
                            + +
                            + + + +
                            + +
                            + +
                            + AnotherParameterizedClass<T> + aInheritedGetter +
                            + + +
                            + +
                            + + + +
                            + +
                            + + test_package 0.0.1 + + +
                            + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/ParameterizedClass/aInheritedMethod.html b/testing/test_package_docs/ex/ParameterizedClass/aInheritedMethod.html new file mode 100644 index 0000000000..dee5d14fde --- /dev/null +++ b/testing/test_package_docs/ex/ParameterizedClass/aInheritedMethod.html @@ -0,0 +1,101 @@ + + + + + + + + aInheritedMethod method - ParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
                            + +
                            + + +
                            aInheritedMethod
                            + +
                            + +
                            + + + +
                            +
                            + AnotherParameterizedClass<T> + aInheritedMethod(int foo) +
                            + + + +
                            + + + +
                            + +
                            + + test_package 0.0.1 + + +
                            + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/ParameterizedClass/aInheritedSetter.html b/testing/test_package_docs/ex/ParameterizedClass/aInheritedSetter.html new file mode 100644 index 0000000000..abfd5904ed --- /dev/null +++ b/testing/test_package_docs/ex/ParameterizedClass/aInheritedSetter.html @@ -0,0 +1,106 @@ + + + + + + + + aInheritedSetter property - ParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
                            + +
                            + + +
                            aInheritedSetter
                            + +
                            + +
                            + + + +
                            + + +
                            + +
                            + void + aInheritedSetter=(AnotherParameterizedClass<T> thingToSet) + +
                            + + +
                            +
                            + + + +
                            + +
                            + + test_package 0.0.1 + + +
                            + + + + + + + + + + + diff --git a/testing/test_package_docs/ex/ParameterizedClass/aInheritedTypedefReturningMethod.html b/testing/test_package_docs/ex/ParameterizedClass/aInheritedTypedefReturningMethod.html new file mode 100644 index 0000000000..b5dc1f69c2 --- /dev/null +++ b/testing/test_package_docs/ex/ParameterizedClass/aInheritedTypedefReturningMethod.html @@ -0,0 +1,101 @@ + + + + + + + + aInheritedTypedefReturningMethod method - ParameterizedClass class - ex library - Dart API + + + + + + + + + + + + +
                            + +
                            + + +
                            aInheritedTypedefReturningMethod
                            + +
                            + +
                            + + + +
                            +
                            + ParameterizedTypedef<T> + aInheritedTypedefReturningMethod() +
                            + + + +
                            + + + +
                            + +
                            + + test_package 0.0.1 + + +
                            + + + + + + + + + + + diff --git a/testing/test_package_docs/fake/ImplementingThingy2/hashCode.html b/testing/test_package_docs/ex/ParameterizedClass/hashCode.html similarity index 54% rename from testing/test_package_docs/fake/ImplementingThingy2/hashCode.html rename to testing/test_package_docs/ex/ParameterizedClass/hashCode.html index 681bee1115..da2bc33bc6 100644 --- a/testing/test_package_docs/fake/ImplementingThingy2/hashCode.html +++ b/testing/test_package_docs/ex/ParameterizedClass/hashCode.html @@ -4,8 +4,8 @@ - - hashCode property - ImplementingThingy2 class - fake library - Dart API + + hashCode property - ParameterizedClass class - ex library - Dart API @@ -24,8 +24,8 @@
                            hashCode
                            @@ -37,26 +37,29 @@
    diff --git a/testing/test_package_docs/fake/ExtraSpecialList-class.html b/testing/test_package_docs/fake/ExtraSpecialList-class.html index 40929af8fb..eb4730312a 100644 --- a/testing/test_package_docs/fake/ExtraSpecialList-class.html +++ b/testing/test_package_docs/fake/ExtraSpecialList-class.html @@ -163,7 +163,7 @@

    Properties

    first - → E + → dynamic
    @@ -195,7 +195,7 @@

    Properties

    iterator - → Iterator<E> + → Iterator
    @@ -203,7 +203,7 @@

    Properties

    last - → E + → dynamic
    @@ -219,7 +219,7 @@

    Properties

    reversed - → Iterable<E> + → Iterable
    @@ -235,7 +235,7 @@

    Properties

    single - → E + → dynamic
    @@ -248,7 +248,7 @@

    Properties

    Methods

    - add(E element) + add(element) → void
    @@ -257,7 +257,7 @@

    Methods

    inherited
    - addAll(Iterable<E> iterable) + addAll(Iterable iterable) → void
    @@ -276,7 +276,7 @@

    Methods

    asMap() - → Map<int, E> + → Map<int, dynamic>
    @@ -303,7 +303,7 @@

    Methods

    elementAt(int index) - → E + → dynamic
    @@ -329,7 +329,7 @@

    Methods

    inherited
    - fillRange(int start, int end, [ E fill ]) + fillRange(int start, int end, [ fill ]) → void
    @@ -338,8 +338,8 @@

    Methods

    inherited
    - firstWhere(bool test(E element), { E orElse() }) - → E + firstWhere(bool test(E element), { dynamic orElse() }) + → dynamic
    @@ -366,7 +366,7 @@

    Methods

    getRange(int start, int end) - → Iterable<E> + → Iterable
    @@ -383,7 +383,7 @@

    Methods

    inherited
    - insert(int index, E element) + insert(int index, element) → void
    @@ -392,7 +392,7 @@

    Methods

    inherited
    - insertAll(int index, Iterable<E> iterable) + insertAll(int index, Iterable iterable) → void
    @@ -419,8 +419,8 @@

    Methods

    inherited
    - lastWhere(bool test(E element), { E orElse() }) - → E + lastWhere(bool test(E element), { dynamic orElse() }) + → dynamic
    @@ -446,8 +446,8 @@

    Methods

    inherited
    - reduce(E combine(E previousValue, E element)) - → E + reduce(dynamic combine(E previousValue, E element)) + → dynamic
    @@ -465,7 +465,7 @@

    Methods

    removeAt(int index) - → E + → dynamic
    @@ -474,7 +474,7 @@

    Methods

    removeLast() - → E + → dynamic
    @@ -500,7 +500,7 @@

    Methods

    inherited
    - replaceRange(int start, int end, Iterable<E> newContents) + replaceRange(int start, int end, Iterable newContents) → void
    @@ -518,7 +518,7 @@

    Methods

    inherited
    - setAll(int index, Iterable<E> iterable) + setAll(int index, Iterable iterable) → void
    @@ -527,7 +527,7 @@

    Methods

    inherited
    - setRange(int start, int end, Iterable<E> iterable, [ int skipCount = 0 ]) + setRange(int start, int end, Iterable iterable, [ int skipCount = 0 ]) → void
    @@ -546,7 +546,7 @@

    Methods

    singleWhere(bool test(E element)) - → E + → dynamic
    @@ -555,7 +555,7 @@

    Methods

    skip(int count) - → Iterable<E> + → Iterable
    @@ -564,7 +564,7 @@

    Methods

    skipWhile(bool test(E element)) - → Iterable<E> + → Iterable
    @@ -582,7 +582,7 @@

    Methods

    sublist(int start, [ int end ]) - → List<E> + → List
    @@ -591,7 +591,7 @@

    Methods

    take(int count) - → Iterable<E> + → Iterable
    @@ -600,7 +600,7 @@

    Methods

    takeWhile(bool test(E element)) - → Iterable<E> + → Iterable
    @@ -609,7 +609,7 @@

    Methods

    toList({bool growable: true }) - → List<E> + → List
    @@ -618,7 +618,7 @@

    Methods

    toSet() - → Set<E> + → Set
    @@ -636,7 +636,7 @@

    Methods

    where(bool test(E element)) - → Iterable<E> + → Iterable
    @@ -660,7 +660,7 @@

    Operators

    operator [](int index) - → E + → dynamic
    @@ -668,7 +668,7 @@

    Operators

    inherited
    - operator []=(int index, E value) + operator []=(int index, value) → void
    diff --git a/testing/test_package_docs/fake/ImplementingThingy-class.html b/testing/test_package_docs/fake/ImplementingThingy-class.html index b9ee8d13ca..5a26f98108 100644 --- a/testing/test_package_docs/fake/ImplementingThingy-class.html +++ b/testing/test_package_docs/fake/ImplementingThingy-class.html @@ -178,7 +178,7 @@

    Properties

    read / write, inherited
    - hashCode + hashCode → int
    @@ -186,7 +186,7 @@

    Properties

    read-only, inherited
    - runtimeType + runtimeType → Type
    @@ -209,7 +209,7 @@

    Methods

    inherited
    - noSuchMethod(Invocation invocation) + noSuchMethod(Invocation invocation) → dynamic
    @@ -218,7 +218,7 @@

    Methods

    inherited
    - toString() + toString() → String
    @@ -233,7 +233,7 @@

    Methods

    Operators

    - operator ==(other) + operator ==(other) → bool
    @@ -260,16 +260,16 @@
    class ImplementingThingy
  • aImplementingThingy
  • aImplementingThingyField
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • aImplementingThingyMethod
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • -
  • operator ==
  • +
  • operator ==
  • diff --git a/testing/test_package_docs/fake/ImplementingThingy/ImplementingThingy.html b/testing/test_package_docs/fake/ImplementingThingy/ImplementingThingy.html index 7997be4cbf..80240e5e97 100644 --- a/testing/test_package_docs/fake/ImplementingThingy/ImplementingThingy.html +++ b/testing/test_package_docs/fake/ImplementingThingy/ImplementingThingy.html @@ -47,16 +47,16 @@
    class ImplementingThingy
  • aImplementingThingy
  • aImplementingThingyField
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • aImplementingThingyMethod
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • -
  • operator ==
  • +
  • operator ==
  • diff --git a/testing/test_package_docs/fake/ImplementingThingy2-class.html b/testing/test_package_docs/fake/ImplementingThingy2-class.html index c606fbdbb3..5ac2614d3f 100644 --- a/testing/test_package_docs/fake/ImplementingThingy2-class.html +++ b/testing/test_package_docs/fake/ImplementingThingy2-class.html @@ -175,7 +175,7 @@

    Properties

    read / write, inherited
    - hashCode + hashCode → int
    @@ -183,7 +183,7 @@

    Properties

    read-only, inherited
    - runtimeType + runtimeType → Type
    @@ -206,7 +206,7 @@

    Methods

    inherited
    - noSuchMethod(Invocation invocation) + noSuchMethod(Invocation invocation) → dynamic
    @@ -215,7 +215,7 @@

    Methods

    inherited
    - toString() + toString() → String
    @@ -230,7 +230,7 @@

    Methods

    Operators

    - operator ==(other) + operator ==(other) → bool
    @@ -257,16 +257,16 @@
    class ImplementingThingy2
  • aImplementingThingy
  • aImplementingThingyField
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • aImplementingThingyMethod
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • -
  • operator ==
  • +
  • operator ==
  • diff --git a/testing/test_package_docs/fake/ImplementingThingy2/ImplementingThingy2.html b/testing/test_package_docs/fake/ImplementingThingy2/ImplementingThingy2.html index 5fbdc781c2..4d0c913cfa 100644 --- a/testing/test_package_docs/fake/ImplementingThingy2/ImplementingThingy2.html +++ b/testing/test_package_docs/fake/ImplementingThingy2/ImplementingThingy2.html @@ -47,16 +47,16 @@
    class ImplementingThingy2
  • aImplementingThingy
  • aImplementingThingyField
  • -
  • hashCode
  • -
  • runtimeType
  • +
  • hashCode
  • +
  • runtimeType
  • Methods
  • aImplementingThingyMethod
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • -
  • operator ==
  • +
  • operator ==
  • diff --git a/testing/test_package_docs/fake/LongFirstLine-class.html b/testing/test_package_docs/fake/LongFirstLine-class.html index b724e55468..e39a3f26f8 100644 --- a/testing/test_package_docs/fake/LongFirstLine-class.html +++ b/testing/test_package_docs/fake/LongFirstLine-class.html @@ -214,7 +214,7 @@

    Properties

    write-only
    - hashCode + hashCode → int
    @@ -230,7 +230,7 @@

    Properties

    read / write, inherited
    - runtimeType + runtimeType → Type
    @@ -289,7 +289,7 @@

    Methods

    inherited
    - noSuchMethod(Invocation invocation) + noSuchMethod(Invocation invocation) → dynamic
    @@ -298,7 +298,7 @@

    Methods

    inherited
    - toString() + toString() → String
    @@ -340,7 +340,7 @@

    Operators

    inherited
    - operator ==(other) + operator ==(other) → bool
    @@ -429,7 +429,7 @@

    Constants

    - 'yup' + 'yup'
    @@ -451,9 +451,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -461,14 +461,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/ANSWER-constant.html b/testing/test_package_docs/fake/LongFirstLine/ANSWER-constant.html index 3897017416..d2c74ea2f4 100644 --- a/testing/test_package_docs/fake/LongFirstLine/ANSWER-constant.html +++ b/testing/test_package_docs/fake/LongFirstLine/ANSWER-constant.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromHasGenerics.html b/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromHasGenerics.html index 57f4863072..eba34f9336 100644 --- a/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromHasGenerics.html +++ b/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromHasGenerics.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromMap.html b/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromMap.html index 52756a7a36..fd42e68d86 100644 --- a/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromMap.html +++ b/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.fromMap.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.html b/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.html index 8a67127415..eba83cf006 100644 --- a/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.html +++ b/testing/test_package_docs/fake/LongFirstLine/LongFirstLine.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/THING-constant.html b/testing/test_package_docs/fake/LongFirstLine/THING-constant.html index 2884f22e13..39bef9e666 100644 --- a/testing/test_package_docs/fake/LongFirstLine/THING-constant.html +++ b/testing/test_package_docs/fake/LongFirstLine/THING-constant.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • @@ -89,7 +89,7 @@
    class LongFirstLine
    dynamic THING = - 'yup' + 'yup'
    diff --git a/testing/test_package_docs/fake/LongFirstLine/aStringProperty.html b/testing/test_package_docs/fake/LongFirstLine/aStringProperty.html index e40be6000b..1a36ccae9a 100644 --- a/testing/test_package_docs/fake/LongFirstLine/aStringProperty.html +++ b/testing/test_package_docs/fake/LongFirstLine/aStringProperty.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/dynamicGetter.html b/testing/test_package_docs/fake/LongFirstLine/dynamicGetter.html index 09254463b3..4a9e42bba1 100644 --- a/testing/test_package_docs/fake/LongFirstLine/dynamicGetter.html +++ b/testing/test_package_docs/fake/LongFirstLine/dynamicGetter.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/meaningOfLife.html b/testing/test_package_docs/fake/LongFirstLine/meaningOfLife.html index 95254b19e4..72b13dc19c 100644 --- a/testing/test_package_docs/fake/LongFirstLine/meaningOfLife.html +++ b/testing/test_package_docs/fake/LongFirstLine/meaningOfLife.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/noParams.html b/testing/test_package_docs/fake/LongFirstLine/noParams.html index 545841ad2d..a4b8225a76 100644 --- a/testing/test_package_docs/fake/LongFirstLine/noParams.html +++ b/testing/test_package_docs/fake/LongFirstLine/noParams.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/onlySetter.html b/testing/test_package_docs/fake/LongFirstLine/onlySetter.html index 3003b184c1..007c459702 100644 --- a/testing/test_package_docs/fake/LongFirstLine/onlySetter.html +++ b/testing/test_package_docs/fake/LongFirstLine/onlySetter.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/operator_multiply.html b/testing/test_package_docs/fake/LongFirstLine/operator_multiply.html index 7862c530d5..4bfd74bcbf 100644 --- a/testing/test_package_docs/fake/LongFirstLine/operator_multiply.html +++ b/testing/test_package_docs/fake/LongFirstLine/operator_multiply.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/operator_plus.html b/testing/test_package_docs/fake/LongFirstLine/operator_plus.html index 5583ebc64d..ce1657cb39 100644 --- a/testing/test_package_docs/fake/LongFirstLine/operator_plus.html +++ b/testing/test_package_docs/fake/LongFirstLine/operator_plus.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/optionalParams.html b/testing/test_package_docs/fake/LongFirstLine/optionalParams.html index d0bb0b6ac5..813335d3e1 100644 --- a/testing/test_package_docs/fake/LongFirstLine/optionalParams.html +++ b/testing/test_package_docs/fake/LongFirstLine/optionalParams.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/returnString.html b/testing/test_package_docs/fake/LongFirstLine/returnString.html index 1fcbf6fd95..6294157163 100644 --- a/testing/test_package_docs/fake/LongFirstLine/returnString.html +++ b/testing/test_package_docs/fake/LongFirstLine/returnString.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/staticGetter.html b/testing/test_package_docs/fake/LongFirstLine/staticGetter.html index 6dbc1aa403..dd55c6094b 100644 --- a/testing/test_package_docs/fake/LongFirstLine/staticGetter.html +++ b/testing/test_package_docs/fake/LongFirstLine/staticGetter.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/staticMethodNoParams.html b/testing/test_package_docs/fake/LongFirstLine/staticMethodNoParams.html index b834d74b0b..1a17202299 100644 --- a/testing/test_package_docs/fake/LongFirstLine/staticMethodNoParams.html +++ b/testing/test_package_docs/fake/LongFirstLine/staticMethodNoParams.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/staticMethodReturnsVoid.html b/testing/test_package_docs/fake/LongFirstLine/staticMethodReturnsVoid.html index 29595b6703..76d72242ea 100644 --- a/testing/test_package_docs/fake/LongFirstLine/staticMethodReturnsVoid.html +++ b/testing/test_package_docs/fake/LongFirstLine/staticMethodReturnsVoid.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/staticOnlySetter.html b/testing/test_package_docs/fake/LongFirstLine/staticOnlySetter.html index 1f6a9da727..af870a484d 100644 --- a/testing/test_package_docs/fake/LongFirstLine/staticOnlySetter.html +++ b/testing/test_package_docs/fake/LongFirstLine/staticOnlySetter.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/LongFirstLine/twoParams.html b/testing/test_package_docs/fake/LongFirstLine/twoParams.html index be8233491d..2f06a220ca 100644 --- a/testing/test_package_docs/fake/LongFirstLine/twoParams.html +++ b/testing/test_package_docs/fake/LongFirstLine/twoParams.html @@ -50,9 +50,9 @@
    class LongFirstLine
  • aStringProperty
  • dynamicGetter
  • onlySetter
  • -
  • hashCode
  • +
  • hashCode
  • powers
  • -
  • runtimeType
  • +
  • runtimeType
  • Methods
  • noParams
  • @@ -60,14 +60,14 @@
    class LongFirstLine
  • returnString
  • twoParams
  • fly
  • -
  • noSuchMethod
  • -
  • toString
  • +
  • noSuchMethod
  • +
  • toString
  • Operators
  • operator *
  • operator +
  • operator -
  • -
  • operator ==
  • +
  • operator ==
  • Static properties
  • meaningOfLife
  • diff --git a/testing/test_package_docs/fake/NewGenericTypedef.html b/testing/test_package_docs/fake/NewGenericTypedef.html index c20104bcef..f502a15891 100644 --- a/testing/test_package_docs/fake/NewGenericTypedef.html +++ b/testing/test_package_docs/fake/NewGenericTypedef.html @@ -126,7 +126,7 @@
    library fake
    List<S> - NewGenericTypedef<S>(T T T) + NewGenericTypedef<S>(T, int, bool)
    diff --git a/testing/test_package_docs/fake/fake-library.html b/testing/test_package_docs/fake/fake-library.html index 7ee37e7253..e31f0402a6 100644 --- a/testing/test_package_docs/fake/fake-library.html +++ b/testing/test_package_docs/fake/fake-library.html @@ -638,7 +638,7 @@

    Typedefs

    - NewGenericTypedef<S>(T T T) + NewGenericTypedef<S>(T, int, bool) → List<S>
    diff --git a/testing/test_package_docs/index.json b/testing/test_package_docs/index.json index f0aa63a07a..7ed48f7c15 100644 --- a/testing/test_package_docs/index.json +++ b/testing/test_package_docs/index.json @@ -133,6 +133,83 @@ "type": "enum" } }, + { + "name": "AnotherParameterizedClass", + "qualifiedName": "ex.AnotherParameterizedClass", + "href": "ex/AnotherParameterizedClass-class.html", + "type": "class", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ex", + "type": "library" + } + }, + { + "name": "AnotherParameterizedClass", + "qualifiedName": "ex.AnotherParameterizedClass", + "href": "ex/AnotherParameterizedClass/AnotherParameterizedClass.html", + "type": "constructor", + "overriddenDepth": 0, + "enclosedBy": { + "name": "AnotherParameterizedClass", + "type": "class" + } + }, + { + "name": "operator ==", + "qualifiedName": "ex.AnotherParameterizedClass.==", + "href": "ex/AnotherParameterizedClass/operator_equals.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "AnotherParameterizedClass", + "type": "class" + } + }, + { + "name": "hashCode", + "qualifiedName": "ex.AnotherParameterizedClass.hashCode", + "href": "ex/AnotherParameterizedClass/hashCode.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "AnotherParameterizedClass", + "type": "class" + } + }, + { + "name": "noSuchMethod", + "qualifiedName": "ex.AnotherParameterizedClass.noSuchMethod", + "href": "ex/AnotherParameterizedClass/noSuchMethod.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "AnotherParameterizedClass", + "type": "class" + } + }, + { + "name": "runtimeType", + "qualifiedName": "ex.AnotherParameterizedClass.runtimeType", + "href": "ex/AnotherParameterizedClass/runtimeType.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "AnotherParameterizedClass", + "type": "class" + } + }, + { + "name": "toString", + "qualifiedName": "ex.AnotherParameterizedClass.toString", + "href": "ex/AnotherParameterizedClass/toString.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "AnotherParameterizedClass", + "type": "class" + } + }, { "name": "Apple", "qualifiedName": "ex.Apple", @@ -793,17 +870,6 @@ "type": "class" } }, - { - "name": "operator ==", - "qualifiedName": "ex.ConstantCat.==", - "href": "ex/ConstantCat/operator_equals.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ConstantCat", - "type": "class" - } - }, { "name": "abstractMethod", "qualifiedName": "ex.ConstantCat.abstractMethod", @@ -815,17 +881,6 @@ "type": "class" } }, - { - "name": "hashCode", - "qualifiedName": "ex.ConstantCat.hashCode", - "href": "ex/ConstantCat/hashCode.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ConstantCat", - "type": "class" - } - }, { "name": "isImplemented", "qualifiedName": "ex.ConstantCat.isImplemented", @@ -848,39 +903,6 @@ "type": "class" } }, - { - "name": "noSuchMethod", - "qualifiedName": "ex.ConstantCat.noSuchMethod", - "href": "ex/ConstantCat/noSuchMethod.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ConstantCat", - "type": "class" - } - }, - { - "name": "runtimeType", - "qualifiedName": "ex.ConstantCat.runtimeType", - "href": "ex/ConstantCat/runtimeType.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ConstantCat", - "type": "class" - } - }, - { - "name": "toString", - "qualifiedName": "ex.ConstantCat.toString", - "href": "ex/ConstantCat/toString.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ConstantCat", - "type": "class" - } - }, { "name": "Deprecated", "qualifiedName": "ex.Deprecated", @@ -1024,6 +1046,17 @@ "type": "class" } }, + { + "name": "aName", + "qualifiedName": "ex.Dog.aName", + "href": "ex/Dog/aName-constant.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "Dog", + "type": "class" + } + }, { "name": "aProtectedFinalField", "qualifiedName": "ex.Dog.aProtectedFinalField", @@ -1145,17 +1178,6 @@ "type": "class" } }, - { - "name": "hashCode", - "qualifiedName": "ex.Dog.hashCode", - "href": "ex/Dog/hashCode.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "Dog", - "type": "class" - } - }, { "name": "isImplemented", "qualifiedName": "ex.Dog.isImplemented", @@ -1178,28 +1200,6 @@ "type": "class" } }, - { - "name": "noSuchMethod", - "qualifiedName": "ex.Dog.noSuchMethod", - "href": "ex/Dog/noSuchMethod.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "Dog", - "type": "class" - } - }, - { - "name": "runtimeType", - "qualifiedName": "ex.Dog.runtimeType", - "href": "ex/Dog/runtimeType.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "Dog", - "type": "class" - } - }, { "name": "somethingTasty", "qualifiedName": "ex.Dog.somethingTasty", @@ -1255,17 +1255,6 @@ "type": "class" } }, - { - "name": "toString", - "qualifiedName": "ex.Dog.toString", - "href": "ex/Dog/toString.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "Dog", - "type": "class" - } - }, { "name": "withMacro", "qualifiedName": "ex.Dog.withMacro", @@ -1365,6 +1354,28 @@ "type": "class" } }, + { + "name": "ExtendedShortName", + "qualifiedName": "ex.ExtendedShortName", + "href": "ex/ExtendedShortName-class.html", + "type": "class", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ex", + "type": "library" + } + }, + { + "name": "ExtendedShortName", + "qualifiedName": "ex.ExtendedShortName", + "href": "ex/ExtendedShortName/ExtendedShortName.html", + "type": "constructor", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ExtendedShortName", + "type": "class" + } + }, { "name": "F", "qualifiedName": "ex.F", @@ -2146,6 +2157,149 @@ "type": "library" } }, + { + "name": "ParameterizedClass", + "qualifiedName": "ex.ParameterizedClass", + "href": "ex/ParameterizedClass-class.html", + "type": "class", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ex", + "type": "library" + } + }, + { + "name": "ParameterizedClass", + "qualifiedName": "ex.ParameterizedClass", + "href": "ex/ParameterizedClass/ParameterizedClass.html", + "type": "constructor", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "operator +", + "qualifiedName": "ex.ParameterizedClass.+", + "href": "ex/ParameterizedClass/operator_plus.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "operator ==", + "qualifiedName": "ex.ParameterizedClass.==", + "href": "ex/ParameterizedClass/operator_equals.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "aInheritedField", + "qualifiedName": "ex.ParameterizedClass.aInheritedField", + "href": "ex/ParameterizedClass/aInheritedField.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "aInheritedGetter", + "qualifiedName": "ex.ParameterizedClass.aInheritedGetter", + "href": "ex/ParameterizedClass/aInheritedGetter.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "aInheritedMethod", + "qualifiedName": "ex.ParameterizedClass.aInheritedMethod", + "href": "ex/ParameterizedClass/aInheritedMethod.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "aInheritedSetter", + "qualifiedName": "ex.ParameterizedClass.aInheritedSetter", + "href": "ex/ParameterizedClass/aInheritedSetter.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "aInheritedTypedefReturningMethod", + "qualifiedName": "ex.ParameterizedClass.aInheritedTypedefReturningMethod", + "href": "ex/ParameterizedClass/aInheritedTypedefReturningMethod.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "hashCode", + "qualifiedName": "ex.ParameterizedClass.hashCode", + "href": "ex/ParameterizedClass/hashCode.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "noSuchMethod", + "qualifiedName": "ex.ParameterizedClass.noSuchMethod", + "href": "ex/ParameterizedClass/noSuchMethod.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "runtimeType", + "qualifiedName": "ex.ParameterizedClass.runtimeType", + "href": "ex/ParameterizedClass/runtimeType.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, + { + "name": "toString", + "qualifiedName": "ex.ParameterizedClass.toString", + "href": "ex/ParameterizedClass/toString.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ParameterizedClass", + "type": "class" + } + }, { "name": "ParameterizedTypedef", "qualifiedName": "ex.ParameterizedTypedef", @@ -2412,23 +2566,111 @@ }, { "name": "runtimeType", - "qualifiedName": "ex.ShapeType.runtimeType", - "href": "ex/ShapeType/runtimeType.html", + "qualifiedName": "ex.ShapeType.runtimeType", + "href": "ex/ShapeType/runtimeType.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ShapeType", + "type": "class" + } + }, + { + "name": "toString", + "qualifiedName": "ex.ShapeType.toString", + "href": "ex/ShapeType/toString.html", + "type": "method", + "overriddenDepth": 1, + "enclosedBy": { + "name": "ShapeType", + "type": "class" + } + }, + { + "name": "ShortName", + "qualifiedName": "ex.ShortName", + "href": "ex/ShortName-class.html", + "type": "class", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ex", + "type": "library" + } + }, + { + "name": "ShortName", + "qualifiedName": "ex.ShortName", + "href": "ex/ShortName/ShortName.html", + "type": "constructor", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ShortName", + "type": "class" + } + }, + { + "name": "operator ==", + "qualifiedName": "ex.ShortName.==", + "href": "ex/ShortName/operator_equals.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ShortName", + "type": "class" + } + }, + { + "name": "aParameter", + "qualifiedName": "ex.ShortName.aParameter", + "href": "ex/ShortName/aParameter.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ShortName", + "type": "class" + } + }, + { + "name": "hashCode", + "qualifiedName": "ex.ShortName.hashCode", + "href": "ex/ShortName/hashCode.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ShortName", + "type": "class" + } + }, + { + "name": "noSuchMethod", + "qualifiedName": "ex.ShortName.noSuchMethod", + "href": "ex/ShortName/noSuchMethod.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ShortName", + "type": "class" + } + }, + { + "name": "runtimeType", + "qualifiedName": "ex.ShortName.runtimeType", + "href": "ex/ShortName/runtimeType.html", "type": "property", "overriddenDepth": 0, "enclosedBy": { - "name": "ShapeType", + "name": "ShortName", "type": "class" } }, { "name": "toString", - "qualifiedName": "ex.ShapeType.toString", - "href": "ex/ShapeType/toString.html", + "qualifiedName": "ex.ShortName.toString", + "href": "ex/ShortName/toString.html", "type": "method", - "overriddenDepth": 1, + "overriddenDepth": 0, "enclosedBy": { - "name": "ShapeType", + "name": "ShortName", "type": "class" } }, @@ -2707,6 +2949,171 @@ "type": "class" } }, + { + "name": "TemplatedClass", + "qualifiedName": "ex.TemplatedClass", + "href": "ex/TemplatedClass-class.html", + "type": "class", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ex", + "type": "library" + } + }, + { + "name": "TemplatedClass", + "qualifiedName": "ex.TemplatedClass", + "href": "ex/TemplatedClass/TemplatedClass.html", + "type": "constructor", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedClass", + "type": "class" + } + }, + { + "name": "operator ==", + "qualifiedName": "ex.TemplatedClass.==", + "href": "ex/TemplatedClass/operator_equals.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedClass", + "type": "class" + } + }, + { + "name": "aMethod", + "qualifiedName": "ex.TemplatedClass.aMethod", + "href": "ex/TemplatedClass/aMethod.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedClass", + "type": "class" + } + }, + { + "name": "hashCode", + "qualifiedName": "ex.TemplatedClass.hashCode", + "href": "ex/TemplatedClass/hashCode.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedClass", + "type": "class" + } + }, + { + "name": "noSuchMethod", + "qualifiedName": "ex.TemplatedClass.noSuchMethod", + "href": "ex/TemplatedClass/noSuchMethod.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedClass", + "type": "class" + } + }, + { + "name": "runtimeType", + "qualifiedName": "ex.TemplatedClass.runtimeType", + "href": "ex/TemplatedClass/runtimeType.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedClass", + "type": "class" + } + }, + { + "name": "toString", + "qualifiedName": "ex.TemplatedClass.toString", + "href": "ex/TemplatedClass/toString.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedClass", + "type": "class" + } + }, + { + "name": "TemplatedInterface", + "qualifiedName": "ex.TemplatedInterface", + "href": "ex/TemplatedInterface-class.html", + "type": "class", + "overriddenDepth": 0, + "enclosedBy": { + "name": "ex", + "type": "library" + } + }, + { + "name": "TemplatedInterface", + "qualifiedName": "ex.TemplatedInterface", + "href": "ex/TemplatedInterface/TemplatedInterface.html", + "type": "constructor", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedInterface", + "type": "class" + } + }, + { + "name": "aField", + "qualifiedName": "ex.TemplatedInterface.aField", + "href": "ex/TemplatedInterface/aField.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedInterface", + "type": "class" + } + }, + { + "name": "aGetter", + "qualifiedName": "ex.TemplatedInterface.aGetter", + "href": "ex/TemplatedInterface/aGetter.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedInterface", + "type": "class" + } + }, + { + "name": "aMethodInterface", + "qualifiedName": "ex.TemplatedInterface.aMethodInterface", + "href": "ex/TemplatedInterface/aMethodInterface.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedInterface", + "type": "class" + } + }, + { + "name": "aSetter", + "qualifiedName": "ex.TemplatedInterface.aSetter", + "href": "ex/TemplatedInterface/aSetter.html", + "type": "property", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedInterface", + "type": "class" + } + }, + { + "name": "aTypedefReturningMethodInterface", + "qualifiedName": "ex.TemplatedInterface.aTypedefReturningMethodInterface", + "href": "ex/TemplatedInterface/aTypedefReturningMethodInterface.html", + "type": "method", + "overriddenDepth": 0, + "enclosedBy": { + "name": "TemplatedInterface", + "type": "class" + } + }, { "name": "TypedFunctionsWithoutTypedefs", "qualifiedName": "ex.TypedFunctionsWithoutTypedefs", @@ -3561,17 +3968,6 @@ "type": "class" } }, - { - "name": "operator ==", - "qualifiedName": "fake.BaseThingy2.==", - "href": "fake/BaseThingy2/operator_equals.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "BaseThingy2", - "type": "class" - } - }, { "name": "aImplementingThingy", "qualifiedName": "fake.BaseThingy2.aImplementingThingy", @@ -3583,50 +3979,6 @@ "type": "class" } }, - { - "name": "hashCode", - "qualifiedName": "fake.BaseThingy2.hashCode", - "href": "fake/BaseThingy2/hashCode.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "BaseThingy2", - "type": "class" - } - }, - { - "name": "noSuchMethod", - "qualifiedName": "fake.BaseThingy2.noSuchMethod", - "href": "fake/BaseThingy2/noSuchMethod.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "BaseThingy2", - "type": "class" - } - }, - { - "name": "runtimeType", - "qualifiedName": "fake.BaseThingy2.runtimeType", - "href": "fake/BaseThingy2/runtimeType.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "BaseThingy2", - "type": "class" - } - }, - { - "name": "toString", - "qualifiedName": "fake.BaseThingy2.toString", - "href": "fake/BaseThingy2/toString.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "BaseThingy2", - "type": "class" - } - }, { "name": "CUSTOM_CLASS", "qualifiedName": "fake.CUSTOM_CLASS", @@ -4518,61 +4870,6 @@ "type": "class" } }, - { - "name": "operator ==", - "qualifiedName": "fake.ImplementingThingy.==", - "href": "fake/ImplementingThingy/operator_equals.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy", - "type": "class" - } - }, - { - "name": "hashCode", - "qualifiedName": "fake.ImplementingThingy.hashCode", - "href": "fake/ImplementingThingy/hashCode.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy", - "type": "class" - } - }, - { - "name": "noSuchMethod", - "qualifiedName": "fake.ImplementingThingy.noSuchMethod", - "href": "fake/ImplementingThingy/noSuchMethod.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy", - "type": "class" - } - }, - { - "name": "runtimeType", - "qualifiedName": "fake.ImplementingThingy.runtimeType", - "href": "fake/ImplementingThingy/runtimeType.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy", - "type": "class" - } - }, - { - "name": "toString", - "qualifiedName": "fake.ImplementingThingy.toString", - "href": "fake/ImplementingThingy/toString.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy", - "type": "class" - } - }, { "name": "ImplementingThingy2", "qualifiedName": "fake.ImplementingThingy2", @@ -4595,61 +4892,6 @@ "type": "class" } }, - { - "name": "operator ==", - "qualifiedName": "fake.ImplementingThingy2.==", - "href": "fake/ImplementingThingy2/operator_equals.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy2", - "type": "class" - } - }, - { - "name": "hashCode", - "qualifiedName": "fake.ImplementingThingy2.hashCode", - "href": "fake/ImplementingThingy2/hashCode.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy2", - "type": "class" - } - }, - { - "name": "noSuchMethod", - "qualifiedName": "fake.ImplementingThingy2.noSuchMethod", - "href": "fake/ImplementingThingy2/noSuchMethod.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy2", - "type": "class" - } - }, - { - "name": "runtimeType", - "qualifiedName": "fake.ImplementingThingy2.runtimeType", - "href": "fake/ImplementingThingy2/runtimeType.html", - "type": "property", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy2", - "type": "class" - } - }, - { - "name": "toString", - "qualifiedName": "fake.ImplementingThingy2.toString", - "href": "fake/ImplementingThingy2/toString.html", - "type": "method", - "overriddenDepth": 0, - "enclosedBy": { - "name": "ImplementingThingy2", - "type": "class" - } - }, { "name": "ImplicitProperties", "qualifiedName": "fake.ImplicitProperties", diff --git a/testing/test_package_small/pubspec.lock b/testing/test_package_small/pubspec.lock new file mode 100644 index 0000000000..c427295339 --- /dev/null +++ b/testing/test_package_small/pubspec.lock @@ -0,0 +1,5 @@ +# Generated by pub +# See http://pub.dartlang.org/doc/glossary.html#lockfile +packages: {} +sdks: + dart: any diff --git a/tool/grind.dart b/tool/grind.dart index 5337bb0c65..755f341b86 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -215,7 +215,7 @@ updateTestPackageDocs() { '--pretty-index-json', '--hide-sdk-text', '--exclude', - 'dart.async,dart.collection,dart.convert,dart.core,dart.math,dart.typed_data,meta', + 'dart.async,dart.collection,dart.convert,dart.core,dart.math,dart.typed_data,package:meta/meta.dart', '--output', '../test_package_docs', ], From 7a134cc54b4f48e457e63d449723824730a7f935 Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Thu, 30 Nov 2017 07:46:24 -0800 Subject: [PATCH 2/4] Fix tests post analyzer update --- lib/src/model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/model.dart b/lib/src/model.dart index ea33089c58..7309617c84 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -3290,7 +3290,7 @@ abstract class ModelElement extends Canonicalization buf.write('${returnTypeName}'); if (showNames) { buf.write(' ${param.name}'); - } else if (param.modelType.element is ModelFunction) { + } else if (param.modelType.element is ModelFunctionAnonymous) { buf.write(' Function'); } if (!isTypedef) { From 93a6d87332d71638dc09dc0b81e25ff7bf7c16c6 Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Thu, 30 Nov 2017 09:27:47 -0800 Subject: [PATCH 3/4] Review comments --- lib/dartdoc.dart | 4 ++-- lib/src/element_type.dart | 5 +---- lib/src/io_utils.dart | 2 -- lib/src/model.dart | 5 ++--- test/src/utils.dart | 36 +----------------------------------- 5 files changed, 6 insertions(+), 46 deletions(-) diff --git a/lib/dartdoc.dart b/lib/dartdoc.dart index 8c567c0ff9..1703f4ceec 100644 --- a/lib/dartdoc.dart +++ b/lib/dartdoc.dart @@ -103,7 +103,7 @@ class DartDoc extends PackageBuilder { List errorInfos = []; // TODO(jcollins-g): figure out why sources can't contain includeExternals // or embedded SDK components without having spurious(?) analysis errors. - // That seems wrong. + // That seems wrong. dart-lang/dartdoc#1547 for (Source source in sources) { context.computeErrors(source); AnalysisErrorInfo info = context.getErrors(source); @@ -116,7 +116,7 @@ class DartDoc extends PackageBuilder { .toList() ..sort(); // TODO(jcollins-g): Why does the SDK have analysis errors? Annotations - // seem correctly formed. + // seem correctly formed. dart-lang/dartdoc#1547 if (errors.isNotEmpty && !source.uri.toString().startsWith('dart:')) { errorInfos.add(info); logWarning( diff --git a/lib/src/element_type.dart b/lib/src/element_type.dart index be0e5ad18a..08169dacd0 100644 --- a/lib/src/element_type.dart +++ b/lib/src/element_type.dart @@ -71,10 +71,7 @@ class ElementType extends Privacy { return _linkedName; } - String get name { - if (_type.name == null) return _type.element.name; - return _type.name; - } + String get name => _type.name ?? _type.element.name; ModelElement get returnElement { Element e; diff --git a/lib/src/io_utils.dart b/lib/src/io_utils.dart index 87baa5e077..b0d02225a6 100644 --- a/lib/src/io_utils.dart +++ b/lib/src/io_utils.dart @@ -7,9 +7,7 @@ library dartdoc.io_utils; import 'dart:io'; -import 'package:dartdoc/src/config.dart'; import 'package:path/path.dart' as path; -import 'package:package_config/discovery.dart' as package_config; /// Lists the contents of [dir]. /// diff --git a/lib/src/model.dart b/lib/src/model.dart index 7309617c84..75a6b9a451 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -2507,9 +2507,8 @@ abstract class ModelElement extends Canonicalization String _fullyQualifiedName; String _fullyQualifiedNameWithoutLibrary; - // WARNING: putting anything into the body of this seems - // to lead to stack overflows. Need to make a registry of ModelElements - // somehow. + // TODO(jcollins-g): make _originalMember optional after dart-lang/sdk#15101 + // is fixed. ModelElement(this._element, this._library, this._originalMember) {} factory ModelElement.fromElement(Element e, Package p) { diff --git a/test/src/utils.dart b/test/src/utils.dart index 8304ddc99e..f33bde4c09 100644 --- a/test/src/utils.dart +++ b/test/src/utils.dart @@ -66,38 +66,4 @@ Package bootBasicPackage( true, withAutoIncludedDependencies) .buildPackage(); -} -/* -@deprecated -class AnalyzerHelper { - AnalysisContext context; - - AnalyzerHelper() { - List resolvers = [ - new DartUriResolver(sdkDir), - new ResourceUriResolver(PhysicalResourceProvider.INSTANCE) - ]; - - SourceFactory sourceFactory = new SourceFactory(resolvers); - AnalysisEngine.instance.processRequiredPlugins(); - context = AnalysisEngine.instance.createAnalysisContext(); - context.sourceFactory = sourceFactory; - } - - Source addSource(String filePath) { - Source source = new FileBasedSource(new JavaFile(filePath)); - ChangeSet changeSet = new ChangeSet(); - changeSet.addedSource(source); - context.applyChanges(changeSet); - // Ensure that the analysis engine performs all remaining work. - AnalysisResult result = context.performAnalysisTask(); - while (result.hasMoreWork) { - result = context.performAnalysisTask(); - } - return source; - } - - LibraryElement resolve(Source librarySource) => - context.computeLibraryElement(librarySource); -} -*/ +} \ No newline at end of file From eedcc55725a523614765ac26d767ab7fe67f48d4 Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Thu, 30 Nov 2017 09:39:07 -0800 Subject: [PATCH 4/4] Disable travis temporarily --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b4cca0783d..f24446fac2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,8 @@ env: - DARTDOC_BOT=main # TODO(devoncarew): add angulardart support #- DARTDOC_BOT=angular - - DARTDOC_BOT=flutter + # TODO(jcollins-g): reenable flutter once it gets flags changed post #1524 + #- DARTDOC_BOT=flutter - DARTDOC_BOT=sdk-docs script: ./tool/travis.sh branches: