dart2js_info: Enable and fix some lints always_declare_return_types unawaited_futures Enabled, fixed then disabled directives_ordering due to code generation Change-Id: Icaf7358222b1c9a939a4764be091e1956d449386 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253365 Commit-Queue: Mark Zhou <markzipan@google.com> Auto-Submit: Kevin Moore <kevmoo@google.com> Commit-Queue: Kevin Moore <kevmoo@google.com> Reviewed-by: Mark Zhou <markzipan@google.com>
diff --git a/pkg/dart2js_info/.status b/pkg/dart2js_info/.status deleted file mode 100644 index 364ca4b..0000000 --- a/pkg/dart2js_info/.status +++ /dev/null
@@ -1,4 +0,0 @@ -# Copyright (c) 2015, 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. -
diff --git a/pkg/dart2js_info/analysis_options.yaml b/pkg/dart2js_info/analysis_options.yaml index 7ad2eaf..4074339 100644 --- a/pkg/dart2js_info/analysis_options.yaml +++ b/pkg/dart2js_info/analysis_options.yaml
@@ -4,3 +4,10 @@ errors: # Until the protobuf package generates the right code - or the right ignores constant_identifier_names: ignore + +linter: + rules: + - always_declare_return_types + # Enable once we update protobuf generation + #- directives_ordering + - unawaited_futures
diff --git a/pkg/dart2js_info/bin/src/code_deps.dart b/pkg/dart2js_info/bin/src/code_deps.dart index d11a043..96c4b0c 100644 --- a/pkg/dart2js_info/bin/src/code_deps.dart +++ b/pkg/dart2js_info/bin/src/code_deps.dart
@@ -29,7 +29,6 @@ import 'package:args/command_runner.dart'; import 'package:collection/collection.dart'; - import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/src/graph.dart'; import 'package:dart2js_info/src/io.dart'; @@ -92,7 +91,7 @@ /// A query supported by this tool. abstract class Query { - run(Graph<Info> graph); + void run(Graph<Info> graph); } /// Query that searches for a single path between two elements.
diff --git a/pkg/dart2js_info/bin/src/convert.dart b/pkg/dart2js_info/bin/src/convert.dart index 7439957..6abb135 100644 --- a/pkg/dart2js_info/bin/src/convert.dart +++ b/pkg/dart2js_info/bin/src/convert.dart
@@ -4,8 +4,8 @@ import 'package:args/command_runner.dart'; -import 'to_json.dart' show ToJsonCommand; import 'to_binary.dart' show ToBinaryCommand; +import 'to_json.dart' show ToJsonCommand; import 'to_proto.dart' show ToProtoCommand; import 'usage_exception.dart'; @@ -22,7 +22,7 @@ _addSubcommand(ToProtoCommand()); } - _addSubcommand(Command<void> command) { + void _addSubcommand(Command<void> command) { addSubcommand(command); command.argParser ..addOption('out',
diff --git a/pkg/dart2js_info/bin/src/coverage_log_server.dart b/pkg/dart2js_info/bin/src/coverage_log_server.dart index 683a935..f93237b 100644 --- a/pkg/dart2js_info/bin/src/coverage_log_server.dart +++ b/pkg/dart2js_info/bin/src/coverage_log_server.dart
@@ -111,7 +111,7 @@ : jsCode = _adjustRequestUrl(File(jsPath).readAsStringSync(), prefix), prefix = _normalize(prefix); - run() async { + Future<void> run() async { await shelf.serve(_handler, hostname, port); var urlBase = "http://$hostname:$port${prefix == '' ? '/' : '/$prefix/'}"; var htmlFilename = htmlPath == null ? '' : path.basename(htmlPath!); @@ -121,7 +121,7 @@ " - coverage reporting: ${urlBase}coverage\n"); } - _expectedPath(String tail) => prefix == '' ? tail : '$prefix/$tail'; + String _expectedPath(String tail) => prefix == '' ? tail : '$prefix/$tail'; FutureOr<shelf.Response> _handler(shelf.Request request) async { var urlPath = request.url.path; @@ -161,7 +161,7 @@ return shelf.Response.notFound('Not found: "$urlPath"'); } - _record(List entries) { + void _record(List entries) { for (var entry in entries) { var id = entry[0]; data.putIfAbsent('$id', () => {'name': entry[1], 'count': 0}); @@ -172,7 +172,7 @@ bool _savePending = false; int _total = 0; - _enqueueSave() async { + Future<void> _enqueueSave() async { if (!_savePending) { _savePending = true; await Future.delayed(Duration(seconds: 3)); @@ -188,13 +188,13 @@ } /// Removes leading and trailing slashes of [uriPath]. -_normalize(String uriPath) { +String _normalize(String uriPath) { if (uriPath.startsWith('/')) uriPath = uriPath.substring(1); if (uriPath.endsWith('/')) uriPath = uriPath.substring(0, uriPath.length - 1); return uriPath; } -_adjustRequestUrl(String code, String prefix) { +String _adjustRequestUrl(String code, String prefix) { var url = prefix == '' ? 'coverage' : '$prefix/coverage'; var hook = ''' self.dartCallInstrumentation = function(id, name) {
diff --git a/pkg/dart2js_info/bin/src/debug_info.dart b/pkg/dart2js_info/bin/src/debug_info.dart index 5a237e4..20efb24 100644 --- a/pkg/dart2js_info/bin/src/debug_info.dart +++ b/pkg/dart2js_info/bin/src/debug_info.dart
@@ -44,7 +44,7 @@ } /// Validates that codesize of elements adds up to total codesize. -validateSize(AllInfo info, String debugLibName) { +void validateSize(AllInfo info, String debugLibName) { // Gather data from visiting all info elements. final tracker = _SizeTracker(debugLibName); info.accept(tracker); @@ -87,10 +87,10 @@ } /// Validates that every element in the model has a parent (except libraries). -validateParents(AllInfo info) { +void validateParents(AllInfo info) { final parentlessInfos = <Info>{}; - failIfNoParents(List<Info> infos) { + void failIfNoParents(List<Info> infos) { for (var info in infos) { if (info.parent == null) { parentlessInfos.add(info); @@ -160,7 +160,7 @@ bool _debug = false; @override - visitLibrary(LibraryInfo info) { + void visitLibrary(LibraryInfo info) { if (_debugLibName != null) _debug = info.name.contains(_debugLibName!); _push(); if (_debug) { @@ -176,7 +176,7 @@ } } - _handleCodeInfo(info) { + void _handleCodeInfo(info) { discovered.add(info); var code = info.code; if (_debug && code != null) { @@ -209,26 +209,26 @@ } @override - visitField(FieldInfo info) { + void visitField(FieldInfo info) { _handleCodeInfo(info); super.visitField(info); } @override - visitFunction(FunctionInfo info) { + void visitFunction(FunctionInfo info) { _handleCodeInfo(info); super.visitFunction(info); } @override - visitTypedef(TypedefInfo info) { + void visitTypedef(TypedefInfo info) { if (_debug) print('$info'); stack.last._totalSize += info.size; super.visitTypedef(info); } @override - visitClass(ClassInfo info) { + void visitClass(ClassInfo info) { if (_debug) { print('$info'); _debugCode.write(' ' * _indent); @@ -246,7 +246,7 @@ } @override - visitClassType(ClassTypeInfo info) { + void visitClassType(ClassTypeInfo info) { if (_debug) { print('$info'); _debugCode.write(' ' * _indent); @@ -304,7 +304,7 @@ // differently than 'deps' links int inUsesNotInDependencies = 0; int inDependenciesNotInUses = 0; - sameEdges(f) { + void sameEdges(f) { var targets1 = g1.targetsOf(f).toSet(); var targets2 = g2.targetsOf(f).toSet(); inUsesNotInDependencies += targets1.difference(targets2).length; @@ -324,7 +324,7 @@ // Validates that all elements are reachable from `main` in the dependency // graph. -verifyDeps(AllInfo info) { +void verifyDeps(AllInfo info) { var graph = graphFromInfo(info); var entrypoint = info.program!.entrypoint; var reachables = Set.from(graph.preOrder(entrypoint)); @@ -340,5 +340,5 @@ } } -_pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); -_fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg'); +void _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg'); +void _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg');
diff --git a/pkg/dart2js_info/bin/src/deferred_library_layout.dart b/pkg/dart2js_info/bin/src/deferred_library_layout.dart index 0e3416b..efe06d7 100644 --- a/pkg/dart2js_info/bin/src/deferred_library_layout.dart +++ b/pkg/dart2js_info/bin/src/deferred_library_layout.dart
@@ -30,7 +30,7 @@ } } -_showLayout(String file) async { +Future<void> _showLayout(String file) async { AllInfo info = await infoFromFile(file); Map<OutputUnitInfo, Map<LibraryInfo, List<BasicInfo>>> hunkMembers = {}; @@ -83,4 +83,4 @@ }); } -_libOf(e) => e is LibraryInfo || e == null ? e : _libOf(e.parent); +dynamic _libOf(e) => e is LibraryInfo || e == null ? e : _libOf(e.parent);
diff --git a/pkg/dart2js_info/bin/src/deferred_library_size.dart b/pkg/dart2js_info/bin/src/deferred_library_size.dart index 6cf0ceb..7819a0f 100644 --- a/pkg/dart2js_info/bin/src/deferred_library_size.dart +++ b/pkg/dart2js_info/bin/src/deferred_library_size.dart
@@ -8,7 +8,6 @@ import 'dart:math'; import 'package:args/command_runner.dart'; - import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/src/io.dart'; @@ -56,7 +55,7 @@ int longest = importSizes.fold('Percent of code deferred'.length, (longest, importSize) => max(longest, importSize.import.length)); - printRow(label, data, {int width = 15}) { + void printRow(label, data, {int width = 15}) { print('${label.toString().padRight(longest + 1)}' '${data.toString().padLeft(width)}'); }
diff --git a/pkg/dart2js_info/bin/src/function_size_analysis.dart b/pkg/dart2js_info/bin/src/function_size_analysis.dart index 04aa819..49c4efc 100644 --- a/pkg/dart2js_info/bin/src/function_size_analysis.dart +++ b/pkg/dart2js_info/bin/src/function_size_analysis.dart
@@ -33,7 +33,7 @@ } } -showCodeDistribution(AllInfo info, +void showCodeDistribution(AllInfo info, {bool Function(Info info)? filter, bool showLibrarySizes = false}) { var realTotal = info.program!.size; filter ??= (i) => true; @@ -152,25 +152,26 @@ } } -_showLibHeader(int namePadding) { +void _showLibHeader(int namePadding) { print(' ${pad("Library", namePadding, right: true)}' ' ${pad("bytes", 8)} ${pad("%", 6)}'); } -_showLib(String msg, int size, int total, int namePadding) { +void _showLib(String msg, int size, int total, int namePadding) { var percent = (size * 100 / total).toStringAsFixed(2); print(' ${pad(msg, namePadding, right: true)}' ' ${pad(size, 8)} ${pad(percent, 6)}%'); } -_showElementHeader() { +void _showElementHeader() { print('${pad("element size", 16)} ' '${pad("dominated size", 18)} ' '${pad("reachable size", 18)} ' 'Element identifier'); } -_showElement(String name, int size, int dominatedSize, int maxSize, int total) { +void _showElement( + String name, int size, int dominatedSize, int maxSize, int total) { var percent = (size * 100 / total).toStringAsFixed(2); var minPercent = (dominatedSize * 100 / total).toStringAsFixed(2); var maxPercent = (maxSize * 100 / total).toStringAsFixed(2);
diff --git a/pkg/dart2js_info/bin/src/inject_text.dart b/pkg/dart2js_info/bin/src/inject_text.dart index 045f7b3..bec6171 100644 --- a/pkg/dart2js_info/bin/src/inject_text.dart +++ b/pkg/dart2js_info/bin/src/inject_text.dart
@@ -33,14 +33,15 @@ Map<String, String> _cache = {}; -_getContents(OutputUnitInfo unit) => _cache.putIfAbsent(unit.filename, () { +String _getContents(OutputUnitInfo unit) => + _cache.putIfAbsent(unit.filename, () { var uri = Uri.base.resolve(unit.filename); return File.fromUri(uri).readAsStringSync(); }); -_fillSpan(CodeSpan span, OutputUnitInfo unit) { +void _fillSpan(CodeSpan span, OutputUnitInfo unit) { if (span.text == null && span.start != null && span.end != 0) { var contents = _getContents(unit); - span.text = contents.substring(span.start, span.end); + span.text = contents.substring(span.start!, span.end); } }
diff --git a/pkg/dart2js_info/bin/src/library_size_split.dart b/pkg/dart2js_info/bin/src/library_size_split.dart index 8a1e77a..c5dae91 100644 --- a/pkg/dart2js_info/bin/src/library_size_split.dart +++ b/pkg/dart2js_info/bin/src/library_size_split.dart
@@ -63,7 +63,6 @@ import 'dart:math' show max; import 'package:args/command_runner.dart'; - import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/src/io.dart'; import 'package:yaml/yaml.dart'; @@ -129,12 +128,12 @@ final realTotal = info.program!.size; var longest = 0; final rows = <_Row>[]; - addRow(String label, int value) { + void addRow(String label, int value) { rows.add(_Row(label, value)); longest = max(longest, label.length); } - printRow(_Row row) { + void printRow(_Row row) { if (row is _Divider) { print(' ${'-' * (longest + 18)}'); return; @@ -205,7 +204,7 @@ const _Divider() : super('', 0); } -_pad(value, n, {bool right = false}) { +String _pad(value, n, {bool right = false}) { final s = '$value'; if (s.length >= n) return s; var pad = ' ' * (n - s.length);
diff --git a/pkg/dart2js_info/bin/src/live_code_size_analysis.dart b/pkg/dart2js_info/bin/src/live_code_size_analysis.dart index 2a4d135..6e4bf19 100644 --- a/pkg/dart2js_info/bin/src/live_code_size_analysis.dart +++ b/pkg/dart2js_info/bin/src/live_code_size_analysis.dart
@@ -38,7 +38,6 @@ import 'dart:io'; import 'package:args/command_runner.dart'; - import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/src/io.dart'; import 'package:dart2js_info/src/util.dart'; @@ -69,7 +68,7 @@ } } -_liveCodeAnalysis(infoFile, coverageFile, bool verbose) async { +Future<void> _liveCodeAnalysis(infoFile, coverageFile, bool verbose) async { var info = await infoFromFile(infoFile); var coverage = jsonDecode(File(coverageFile).readAsStringSync()); @@ -132,11 +131,11 @@ } } -_showHeader(String msg, String header1, String header2) { +void _showHeader(String msg, String header1, String header2) { print(' ${pad(msg, 30, right: true)} ${pad(header1, 8)} ${pad(header2, 6)}'); } -_show(String msg, int size, int total) { +void _show(String msg, int size, int total) { var percent = (size * 100 / total).toStringAsFixed(2); print(' ${pad(msg, 30, right: true)} ${pad(size, 8)} ${pad(percent, 6)}%'); }
diff --git a/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart b/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart index 5c8019d..9d4bcbe 100644 --- a/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart +++ b/pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart
@@ -32,7 +32,6 @@ import 'package:args/command_runner.dart'; import 'package:collection/collection.dart'; - import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/src/io.dart'; import 'package:dart2js_info/src/util.dart'; @@ -67,7 +66,7 @@ if (showPackages) { await _reportWithPackages(args[0], args[1]); } else if (filterFile.isNotEmpty) { - _reportWithClassFilter(args[0], args[1], filterFile); + await _reportWithClassFilter(args[0], args[1], filterFile); } else { await _report(args[0], args[1]); } @@ -434,16 +433,16 @@ print('=' * 72); } -_showHeader(String msg, String header1, String header2) { +void _showHeader(String msg, String header1, String header2) { print(' ${pad(msg, 30, right: true)} ${pad(header1, 8)} ${pad(header2, 6)}'); } -_show(String msg, int size, int total) { +void _show(String msg, int size, int total) { var percent = (size * 100 / total).toStringAsFixed(2); print(' ${pad(msg, 30, right: true)} ${pad(size, 8)} ${pad(percent, 6)}%'); } -_leftPadded(String msg1, String msg2) { +void _leftPadded(String msg1, String msg2) { print(' ${pad(msg1, 50, right: true)} $msg2'); }
diff --git a/pkg/dart2js_info/bin/src/show_inferred_types.dart b/pkg/dart2js_info/bin/src/show_inferred_types.dart index 417d839..4238fea 100644 --- a/pkg/dart2js_info/bin/src/show_inferred_types.dart +++ b/pkg/dart2js_info/bin/src/show_inferred_types.dart
@@ -8,9 +8,8 @@ import 'dart:io'; import 'package:args/command_runner.dart'; - -import 'package:dart2js_info/src/util.dart'; import 'package:dart2js_info/src/io.dart'; +import 'package:dart2js_info/src/util.dart'; import 'usage_exception.dart'; @@ -33,14 +32,15 @@ usageException( 'Missing arguments, expected: info.data <function-name-regex>'); } - _showInferredTypes(args[0], args[1], argRes['long-names']); + await _showInferredTypes(args[0], args[1], argRes['long-names']); } } -_showInferredTypes(String infoFile, String pattern, bool showLongName) async { +Future<void> _showInferredTypes( + String infoFile, String pattern, bool showLongName) async { var info = await infoFromFile(infoFile); var nameRegExp = RegExp(pattern); - matches(e) => nameRegExp.hasMatch(longName(e)); + bool matches(e) => nameRegExp.hasMatch(longName(e)); bool noResults = true; void showMethods() {
diff --git a/pkg/dart2js_info/bin/src/to_binary.dart b/pkg/dart2js_info/bin/src/to_binary.dart index 2f97835..60eefb5 100644 --- a/pkg/dart2js_info/bin/src/to_binary.dart +++ b/pkg/dart2js_info/bin/src/to_binary.dart
@@ -5,9 +5,8 @@ import 'dart:io'; import 'package:args/command_runner.dart'; - -import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/binary_serialization.dart' as binary; +import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/src/io.dart'; import 'inject_text.dart';
diff --git a/pkg/dart2js_info/bin/src/to_devtools_format.dart b/pkg/dart2js_info/bin/src/to_devtools_format.dart index 9d8e756..8e12f5d 100644 --- a/pkg/dart2js_info/bin/src/to_devtools_format.dart +++ b/pkg/dart2js_info/bin/src/to_devtools_format.dart
@@ -1,13 +1,14 @@ import 'dart:convert'; import 'dart:io'; -import 'usage_exception.dart'; -import 'package:args/command_runner.dart'; +import 'package:args/command_runner.dart'; import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/src/io.dart'; -import 'package:vm_snapshot_analysis/treemap.dart'; import 'package:dart2js_info/src/util.dart'; import 'package:vm_snapshot_analysis/program_info.dart' as vm; +import 'package:vm_snapshot_analysis/treemap.dart'; + +import 'usage_exception.dart'; /// Command that converts a `--dump-info` JSON output into a format ingested by Devtools. ///
diff --git a/pkg/dart2js_info/bin/src/to_json.dart b/pkg/dart2js_info/bin/src/to_json.dart index 2e6b117..5a6c806 100644 --- a/pkg/dart2js_info/bin/src/to_json.dart +++ b/pkg/dart2js_info/bin/src/to_json.dart
@@ -2,11 +2,10 @@ // 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. -import 'dart:io'; import 'dart:convert'; +import 'dart:io'; import 'package:args/command_runner.dart'; - import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/json_info_codec.dart'; import 'package:dart2js_info/src/io.dart';
diff --git a/pkg/dart2js_info/bin/tools.dart b/pkg/dart2js_info/bin/tools.dart index ab2c1bf..75c8b56 100644 --- a/pkg/dart2js_info/bin/tools.dart +++ b/pkg/dart2js_info/bin/tools.dart
@@ -6,13 +6,13 @@ import 'src/code_deps.dart'; import 'src/common_command.dart'; +import 'src/convert.dart'; import 'src/coverage_log_server.dart'; import 'src/debug_info.dart'; -import 'src/diff.dart'; import 'src/deferred_library_check.dart'; -import 'src/deferred_library_size.dart'; import 'src/deferred_library_layout.dart'; -import 'src/convert.dart'; +import 'src/deferred_library_size.dart'; +import 'src/diff.dart'; import 'src/function_size_analysis.dart'; import 'src/library_size_split.dart'; import 'src/live_code_size_analysis.dart';
diff --git a/pkg/dart2js_info/lib/binary_serialization.dart b/pkg/dart2js_info/lib/binary_serialization.dart index 2e55724..ef241ca 100644 --- a/pkg/dart2js_info/lib/binary_serialization.dart +++ b/pkg/dart2js_info/lib/binary_serialization.dart
@@ -8,9 +8,9 @@ import 'dart:convert'; +import 'info.dart'; import 'src/binary/sink.dart'; import 'src/binary/source.dart'; -import 'info.dart'; void encode(AllInfo info, Sink<List<int>> sink) { BinaryPrinter(BinarySink(sink)).visitAll(info); @@ -143,7 +143,7 @@ }); } - _visitCodeSpan(CodeSpan code) { + void _visitCodeSpan(CodeSpan code) { sink.writeIntOrNull(code.start); sink.writeIntOrNull(code.end); sink.writeStringOrNull(code.text); @@ -376,7 +376,7 @@ info.classTypes.addAll(source.readList(readClassType)); info.typedefs.addAll(source.readList(readTypedef)); - setParent(BasicInfo child) => child.parent = info; + LibraryInfo setParent(BasicInfo child) => child.parent = info; info.topLevelFunctions.forEach(setParent); info.topLevelVariables.forEach(setParent); info.classes.forEach(setParent); @@ -393,7 +393,7 @@ info.functions.addAll(source.readList(readFunction)); info.supers.addAll(source.readList(readClass)); - setParent(BasicInfo child) => child.parent = info; + ClassInfo setParent(BasicInfo child) => child.parent = info; info.fields.forEach(setParent); info.functions.forEach(setParent); return info;
diff --git a/pkg/dart2js_info/lib/deferred_library_check.dart b/pkg/dart2js_info/lib/deferred_library_check.dart index 07d53dc..c7e50b8 100644 --- a/pkg/dart2js_info/lib/deferred_library_check.dart +++ b/pkg/dart2js_info/lib/deferred_library_check.dart
@@ -87,7 +87,7 @@ var failures = <ManifestComplianceFailure>[]; - checkInfo(BasicInfo info) { + void checkInfo(BasicInfo info) { if (info.size == 0) return; var lib = _getLibraryOf(info); if (lib != null && _isPackageUri(lib.uri)) {
diff --git a/pkg/dart2js_info/lib/info.dart b/pkg/dart2js_info/lib/info.dart index 94140c4..051d75a 100644 --- a/pkg/dart2js_info/lib/info.dart +++ b/pkg/dart2js_info/lib/info.dart
@@ -632,7 +632,7 @@ /// so on. class RecursiveInfoVisitor extends InfoVisitor<void> { @override - visitAll(AllInfo info) { + void visitAll(AllInfo info) { // Note: we don't visit functions, fields, classes, and typedefs because // they are reachable from the library info. info.libraries.forEach(visitLibrary); @@ -640,10 +640,10 @@ } @override - visitProgram(ProgramInfo info) {} + void visitProgram(ProgramInfo info) {} @override - visitLibrary(LibraryInfo info) { + void visitLibrary(LibraryInfo info) { info.topLevelFunctions.forEach(visitFunction); info.topLevelVariables.forEach(visitField); info.classes.forEach(visitClass); @@ -652,33 +652,33 @@ } @override - visitClass(ClassInfo info) { + void visitClass(ClassInfo info) { info.functions.forEach(visitFunction); info.fields.forEach(visitField); } @override - visitClassType(ClassTypeInfo info) {} + void visitClassType(ClassTypeInfo info) {} @override - visitField(FieldInfo info) { + void visitField(FieldInfo info) { info.closures.forEach(visitClosure); } @override - visitConstant(ConstantInfo info) {} + void visitConstant(ConstantInfo info) {} @override - visitFunction(FunctionInfo info) { + void visitFunction(FunctionInfo info) { info.closures.forEach(visitClosure); } @override - visitTypedef(TypedefInfo info) {} + void visitTypedef(TypedefInfo info) {} @override - visitOutput(OutputUnitInfo info) {} + void visitOutput(OutputUnitInfo info) {} @override - visitClosure(ClosureInfo info) { + void visitClosure(ClosureInfo info) { visitFunction(info.function); } }
diff --git a/pkg/dart2js_info/lib/json_info_codec.dart b/pkg/dart2js_info/lib/json_info_codec.dart index a969a9d..4e0bc18 100644 --- a/pkg/dart2js_info/lib/json_info_codec.dart +++ b/pkg/dart2js_info/lib/json_info_codec.dart
@@ -591,10 +591,11 @@ } @override - visitTypedef(TypedefInfo info) => _visitBasicInfo(info)..['type'] = info.type; + Map visitTypedef(TypedefInfo info) => + _visitBasicInfo(info)..['type'] = info.type; @override - visitOutput(OutputUnitInfo info) => _visitBasicInfo(info) + Map visitOutput(OutputUnitInfo info) => _visitBasicInfo(info) ..['filename'] = info.filename ..['imports'] = info.imports;
diff --git a/pkg/dart2js_info/lib/src/common_element.dart b/pkg/dart2js_info/lib/src/common_element.dart index ff3c055..6e7f635 100644 --- a/pkg/dart2js_info/lib/src/common_element.dart +++ b/pkg/dart2js_info/lib/src/common_element.dart
@@ -7,7 +7,7 @@ CommonElement(this.oldInfo, this.newInfo); - get name => longName(oldInfo, useLibraryUri: true); + String get name => longName(oldInfo, useLibraryUri: true); } List<CommonElement> findCommonalities(AllInfo oldInfo, AllInfo newInfo) { @@ -31,27 +31,27 @@ } @override - visitAll(AllInfo info) { + void visitAll(AllInfo info) { throw StateError('should not run common on AllInfo'); } @override - visitProgram(ProgramInfo info) { + void visitProgram(ProgramInfo info) { throw StateError('should not run common on ProgramInfo'); } @override - visitOutput(OutputUnitInfo info) { + void visitOutput(OutputUnitInfo info) { throw StateError('should not run common on OutputUnitInfo'); } @override - visitConstant(ConstantInfo info) { + void visitConstant(ConstantInfo info) { throw StateError('should not run common on ConstantInfo'); } @override - visitLibrary(LibraryInfo info) { + void visitLibrary(LibraryInfo info) { var other = _other as LibraryInfo; commonElements.add(CommonElement(info, other)); _commonList(info.topLevelVariables, other.topLevelVariables); @@ -60,7 +60,7 @@ } @override - visitClass(ClassInfo info) { + void visitClass(ClassInfo info) { var other = _other as ClassInfo; commonElements.add(CommonElement(info, other)); _commonList(info.fields, other.fields); @@ -68,34 +68,34 @@ } @override - visitClassType(ClassTypeInfo info) { + void visitClassType(ClassTypeInfo info) { var other = _other as ClassInfo; commonElements.add(CommonElement(info, other)); } @override - visitClosure(ClosureInfo info) { + void visitClosure(ClosureInfo info) { var other = _other as ClosureInfo; commonElements.add(CommonElement(info, other)); _commonList([info.function], [other.function]); } @override - visitField(FieldInfo info) { + void visitField(FieldInfo info) { var other = _other as FieldInfo; commonElements.add(CommonElement(info, other)); _commonList(info.closures, other.closures); } @override - visitFunction(FunctionInfo info) { + void visitFunction(FunctionInfo info) { var other = _other as FunctionInfo; commonElements.add(CommonElement(info, other)); _commonList(info.closures, other.closures); } @override - visitTypedef(TypedefInfo info) { + void visitTypedef(TypedefInfo info) { var other = _other as ClassInfo; commonElements.add(CommonElement(info, other)); }
diff --git a/pkg/dart2js_info/lib/src/diff.dart b/pkg/dart2js_info/lib/src/diff.dart index bcd6431..ce2024d 100644 --- a/pkg/dart2js_info/lib/src/diff.dart +++ b/pkg/dart2js_info/lib/src/diff.dart
@@ -49,28 +49,28 @@ } @override - visitAll(AllInfo info) { + void visitAll(AllInfo info) { throw StateError('should not diff AllInfo'); } @override - visitProgram(ProgramInfo info) { + void visitProgram(ProgramInfo info) { throw StateError('should not diff ProgramInfo'); } @override - visitOutput(OutputUnitInfo info) { + void visitOutput(OutputUnitInfo info) { throw StateError('should not diff OutputUnitInfo'); } // TODO(het): diff constants @override - visitConstant(ConstantInfo info) { + void visitConstant(ConstantInfo info) { throw StateError('should not diff ConstantInfo'); } @override - visitLibrary(LibraryInfo info) { + void visitLibrary(LibraryInfo info) { var other = _other as LibraryInfo; _checkSize(info, other); _diffList(info.topLevelVariables, other.topLevelVariables); @@ -79,7 +79,7 @@ } @override - visitClass(ClassInfo info) { + void visitClass(ClassInfo info) { var other = _other as ClassInfo; _checkSize(info, other); _checkDeferredStatus(info, other); @@ -88,14 +88,14 @@ } @override - visitClassType(ClassTypeInfo info) { + void visitClassType(ClassTypeInfo info) { var other = _other as ClassTypeInfo; _checkSize(info, other); _checkDeferredStatus(info, other); } @override - visitClosure(ClosureInfo info) { + void visitClosure(ClosureInfo info) { var other = _other as ClosureInfo; _checkSize(info, other); _checkDeferredStatus(info, other); @@ -103,7 +103,7 @@ } @override - visitField(FieldInfo info) { + void visitField(FieldInfo info) { var other = _other as FieldInfo; _checkSize(info, other); _checkDeferredStatus(info, other); @@ -111,7 +111,7 @@ } @override - visitFunction(FunctionInfo info) { + void visitFunction(FunctionInfo info) { var other = _other as FunctionInfo; _checkSize(info, other); _checkDeferredStatus(info, other); @@ -119,7 +119,7 @@ } @override - visitTypedef(TypedefInfo info) { + void visitTypedef(TypedefInfo info) { var other = _other as TypedefInfo; _checkSize(info, other); _checkDeferredStatus(info, other);
diff --git a/pkg/dart2js_info/lib/src/graph.dart b/pkg/dart2js_info/lib/src/graph.dart index c416b05..793227fb 100644 --- a/pkg/dart2js_info/lib/src/graph.dart +++ b/pkg/dart2js_info/lib/src/graph.dart
@@ -288,7 +288,7 @@ Map<N, int> postOrderId = {}; _DominatorFinder(this._graph); - run(N root) { + void run(N root) { immediateDominators[root] = root; bool changed = true; int i = 0;
diff --git a/pkg/dart2js_info/lib/src/io.dart b/pkg/dart2js_info/lib/src/io.dart index a80da7c..fcc1fe1 100644 --- a/pkg/dart2js_info/lib/src/io.dart +++ b/pkg/dart2js_info/lib/src/io.dart
@@ -5,9 +5,9 @@ import 'dart:convert'; import 'dart:io'; +import 'package:dart2js_info/binary_serialization.dart' as binary; import 'package:dart2js_info/info.dart'; import 'package:dart2js_info/json_info_codec.dart'; -import 'package:dart2js_info/binary_serialization.dart' as binary; Future<AllInfo> infoFromFile(String fileName) async { var file = File(fileName);
diff --git a/pkg/dart2js_info/lib/src/util.dart b/pkg/dart2js_info/lib/src/util.dart index 48bb5d1..8f7a058 100644 --- a/pkg/dart2js_info/lib/src/util.dart +++ b/pkg/dart2js_info/lib/src/util.dart
@@ -149,7 +149,7 @@ } /// Produce a string containing [value] padded with white space up to [n] chars. -pad(value, n, {bool right = false}) { +String pad(value, n, {bool right = false}) { var s = '$value'; if (s.length >= n) return s; var pad = ' ' * (n - s.length);
diff --git a/pkg/dart2js_info/test/binary_serialization_test.dart b/pkg/dart2js_info/test/binary_serialization_test.dart index 842b212..635191e 100644 --- a/pkg/dart2js_info/test/binary_serialization_test.dart +++ b/pkg/dart2js_info/test/binary_serialization_test.dart
@@ -6,20 +6,20 @@ import 'dart:io' show File, Platform; import 'dart:typed_data' show BytesBuilder; -import 'package:dart2js_info/json_info_codec.dart'; import 'package:dart2js_info/binary_serialization.dart' as binary; +import 'package:dart2js_info/json_info_codec.dart'; import 'package:test/test.dart'; class ByteSink implements Sink<List<int>> { BytesBuilder builder = BytesBuilder(); @override - add(List<int> data) => builder.add(data); + void add(List<int> data) => builder.add(data); @override - close() {} + void close() {} } -main() { +void main() { group('json to proto conversion with deferred files', () { test('hello_world_deferred', () { var uri = Platform.script
diff --git a/pkg/dart2js_info/test/classes/classes.dart b/pkg/dart2js_info/test/classes/classes.dart index d7b49e0..c4f87d1 100644 --- a/pkg/dart2js_info/test/classes/classes.dart +++ b/pkg/dart2js_info/test/classes/classes.dart
@@ -35,7 +35,7 @@ } } -main() { +void main() { Super<Object> s = Subclass()..test(); Expect.throws(() => s.method('')); dynamic x = Subsub1();
diff --git a/pkg/dart2js_info/test/graph_test.dart b/pkg/dart2js_info/test/graph_test.dart index 71afc23..003c810 100644 --- a/pkg/dart2js_info/test/graph_test.dart +++ b/pkg/dart2js_info/test/graph_test.dart
@@ -5,7 +5,7 @@ import 'package:dart2js_info/src/graph.dart'; import 'package:test/test.dart'; -main() { +void main() { var graph = makeTestGraph(); test('preorder traversal', () {
diff --git a/pkg/dart2js_info/test/hello_world/hello_world.dart b/pkg/dart2js_info/test/hello_world/hello_world.dart index 800db1c..5eee9c4 100644 --- a/pkg/dart2js_info/test/hello_world/hello_world.dart +++ b/pkg/dart2js_info/test/hello_world/hello_world.dart
@@ -1,3 +1,3 @@ -main() { +void main() { print("Hello, World!"); }
diff --git a/pkg/dart2js_info/test/json_to_proto_deferred_test.dart b/pkg/dart2js_info/test/json_to_proto_deferred_test.dart index d88c036..831248d 100644 --- a/pkg/dart2js_info/test/json_to_proto_deferred_test.dart +++ b/pkg/dart2js_info/test/json_to_proto_deferred_test.dart
@@ -9,7 +9,7 @@ import 'package:dart2js_info/proto_info_codec.dart'; import 'package:test/test.dart'; -main() { +void main() { group('json to proto conversion with deferred files', () { test('hello_world_deferred', () { var uri = Platform.script
diff --git a/pkg/dart2js_info/test/json_to_proto_test.dart b/pkg/dart2js_info/test/json_to_proto_test.dart index 95d75be..10da832 100644 --- a/pkg/dart2js_info/test/json_to_proto_test.dart +++ b/pkg/dart2js_info/test/json_to_proto_test.dart
@@ -10,7 +10,7 @@ import 'package:dart2js_info/proto_info_codec.dart'; import 'package:test/test.dart'; -main() { +void main() { group('json to proto conversion', () { test('hello_world', () { var uri = Platform.script.resolve('hello_world/hello_world.js.info.json');
diff --git a/pkg/dart2js_info/test/parse_test.dart b/pkg/dart2js_info/test/parse_test.dart index 0145a79..193e481 100644 --- a/pkg/dart2js_info/test/parse_test.dart +++ b/pkg/dart2js_info/test/parse_test.dart
@@ -8,7 +8,7 @@ import 'package:dart2js_info/json_info_codec.dart'; import 'package:test/test.dart'; -main() { +void main() { group('parse', () { test('hello_world', () { var uri = Platform.script.resolve('hello_world/hello_world.js.info.json');