Skip to content

Commit ac30ab1

Browse files
nshahancommit-bot@chromium.org
authored andcommitted
[dartdevc] Bump pedantic to v1.8.0 and apply new lints
Cleanup violations of: * `prefer_iterable_whereType` * `unnecessary_const` * `unnecessary_new` Ignore violations in lib/src/js_ast to avoid additional diffs when un-forking. Change-Id: I7333903422bbf635cd0dea82116372f305f679d8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108182 Auto-Submit: Nicholas Shahan <[email protected]> Reviewed-by: Nate Bosch <[email protected]> Commit-Queue: Nate Bosch <[email protected]>
1 parent 4b0c5c1 commit ac30ab1

14 files changed

Lines changed: 28 additions & 30 deletions

File tree

‎DEPS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ vars = {
109109
"package_config_tag": "1.0.5",
110110
"package_resolver_tag": "1.0.10",
111111
"path_tag": "1.6.2",
112-
"pedantic_tag": "v1.7.0",
112+
"pedantic_tag": "v1.8.0",
113113
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
114114
"pool_tag": "1.3.6",
115115
"protobuf_rev": "7d34c9e4e552a4f66acce32e4344ae27756a1949",

‎pkg/dev_compiler/analysis_options.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:pedantic/analysis_options.1.7.0.yaml
1+
include: package:pedantic/analysis_options.1.8.0.yaml
22

33
analyzer:
44
strong-mode:

‎pkg/dev_compiler/bin/dartdevc.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Future main(List<String> args, [SendPort sendPort]) async {
2323

2424
if (parsedArgs.isWorker) {
2525
var workerConnection = sendPort == null
26-
? new StdAsyncWorkerConnection()
27-
: new SendPortAsyncWorkerConnection(sendPort);
26+
? StdAsyncWorkerConnection()
27+
: SendPortAsyncWorkerConnection(sendPort);
2828
await _CompilerWorker(parsedArgs, workerConnection).run();
2929
} else if (parsedArgs.isBatch) {
3030
await runBatch(parsedArgs);

‎pkg/dev_compiler/lib/src/analyzer/code_generator.dart‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5498,7 +5498,7 @@ class CodeGenerator extends Object
54985498
variable = forParts.loopVariable.identifier;
54995499
init = js.call('let # = #.current', [_emitVariableDef(variable), iter]);
55005500
} else {
5501-
throw new StateError('Unrecognized for loop parts');
5501+
throw StateError('Unrecognized for loop parts');
55025502
}
55035503
return js.statement(
55045504
'{'
@@ -6516,7 +6516,7 @@ class CodeGenerator extends Object
65166516
} else if (forParts is ForPartsWithDeclarations) {
65176517
init = visitVariableDeclarationList(forParts.variables);
65186518
} else {
6519-
throw new StateError('Unrecognized for loop parts');
6519+
throw StateError('Unrecognized for loop parts');
65206520
}
65216521
js_ast.Expression update;
65226522
if (forParts.updaters != null && forParts.updaters.isNotEmpty) {
@@ -6548,7 +6548,7 @@ class CodeGenerator extends Object
65486548
]);
65496549
}
65506550
} else {
6551-
throw new StateError('Unrecognized for loop parts');
6551+
throw StateError('Unrecognized for loop parts');
65526552
}
65536553
return js_ast.ForOf(jsLeftExpression, jsIterable, jsBody);
65546554
}
@@ -6618,7 +6618,7 @@ class CodeGenerator extends Object
66186618
} else if (forParts is ForEachPartsWithDeclaration) {
66196619
variable = forParts.loopVariable.identifier;
66206620
} else {
6621-
throw new StateError('Unrecognized for loop parts');
6621+
throw StateError('Unrecognized for loop parts');
66226622
}
66236623
var castType = getImplicitCast(variable);
66246624
if (castType != null) {

‎pkg/dev_compiler/lib/src/analyzer/nullable_type_inference.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class _NullableLocalInference extends RecursiveAstVisitor {
369369
_nullableLocals.add(element);
370370
}
371371
} else {
372-
throw new StateError('Unrecognized for loop parts');
372+
throw StateError('Unrecognized for loop parts');
373373
}
374374
}
375375
super.visitForStatement(node);

‎pkg/dev_compiler/lib/src/compiler/js_metalet.dart‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,8 @@ T _substitute<T extends Node>(
292292
T tree, Map<MetaLetVariable, Expression> substitutions) {
293293
var generator = InstantiatorGeneratorVisitor(/*forceCopy:*/ false);
294294
var instantiator = generator.compile(tree);
295-
var nodes = List<MetaLetVariable>.from(generator
296-
.analysis.containsInterpolatedNode
297-
.where((n) => n is MetaLetVariable));
295+
var nodes = List<MetaLetVariable>.from(
296+
generator.analysis.containsInterpolatedNode.whereType<MetaLetVariable>());
298297
if (nodes.isEmpty) return tree;
299298

300299
return instantiator(Map.fromIterable(nodes,

‎pkg/dev_compiler/lib/src/compiler/shared_command.dart‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'dart:async';
6-
import 'dart:collection';
76
import 'dart:io';
87
import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine;
98
import 'package:args/args.dart';
@@ -263,8 +262,8 @@ Map<String, String> _parseBazelMappings(List<String> argument) {
263262
List<String> filterUnknownArguments(List<String> args, ArgParser parser) {
264263
if (!args.contains('--ignore-unrecognized-flags')) return args;
265264

266-
var knownOptions = new HashSet<String>();
267-
var knownAbbreviations = new HashSet<String>();
265+
var knownOptions = <String>{};
266+
var knownAbbreviations = <String>{};
268267
parser.options.forEach((String name, Option option) {
269268
knownOptions.add(name);
270269
var abbreviation = option.abbr;

‎pkg/dev_compiler/lib/src/js_ast/builder.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: slash_for_doc_comments
5+
// ignore_for_file: slash_for_doc_comments, unnecessary_new
66

77
// Utilities for building JS ASTs at runtime. Contains a builder class
88
// and a parser that parses part of the language.

‎pkg/dev_compiler/lib/src/js_ast/printer.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// ignore_for_file: slash_for_doc_comments
5+
// ignore_for_file: slash_for_doc_comments, unnecessary_const
66

77
part of js_ast;
88

‎pkg/dev_compiler/lib/src/kernel/command.dart‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ Future<CompilerResult> _compile(List<String> args,
248248
fileSystem: fileSystem,
249249
experiments: experiments);
250250
} else {
251-
doneInputSummaries = new List<Component>(summaryModules.length);
251+
doneInputSummaries = List<Component>(summaryModules.length);
252252
compilerState = await fe.initializeIncrementalCompiler(
253253
oldCompilerState,
254254
doneInputSummaries,
@@ -292,7 +292,7 @@ Future<CompilerResult> _compile(List<String> args,
292292
Component incrementalComponent = await incrementalCompiler.computeDelta(
293293
entryPoints: inputs, fullComponent: true);
294294
hierarchy = incrementalCompiler.userCode.loader.hierarchy;
295-
result = new fe.DdcResult(incrementalComponent, doneInputSummaries);
295+
result = fe.DdcResult(incrementalComponent, doneInputSummaries);
296296

297297
// Workaround for DDC relying on isExternal being set to true.
298298
for (var lib in cachedSdkInput.component.libraries) {
@@ -335,7 +335,7 @@ Future<CompilerResult> _compile(List<String> args,
335335
outFiles.add(sink.flush().then((_) => sink.close()));
336336
}
337337
if (argResults['summarize-text'] as bool) {
338-
StringBuffer sb = new StringBuffer();
338+
StringBuffer sb = StringBuffer();
339339
kernel.Printer(sb, showExternal: false).writeComponentFile(component);
340340
outFiles.add(File(output + '.txt').writeAsString(sb.toString()));
341341
}

0 commit comments

Comments
 (0)