[pkg/dart2wasm] use package:lints for analysis
Change-Id: I5a17a8e8a5213dc30f4a2dd29fafac0a2030c722
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250780
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
diff --git a/pkg/dart2wasm/analysis_options.yaml b/pkg/dart2wasm/analysis_options.yaml
new file mode 100644
index 0000000..c36c2c5
--- /dev/null
+++ b/pkg/dart2wasm/analysis_options.yaml
@@ -0,0 +1 @@
+include: package:lints/core.yaml
diff --git a/pkg/dart2wasm/lib/closures.dart b/pkg/dart2wasm/lib/closures.dart
index 7929e21..221113c 100644
--- a/pkg/dart2wasm/lib/closures.dart
+++ b/pkg/dart2wasm/lib/closures.dart
@@ -293,7 +293,9 @@
bool outerMost = currentContext == null;
Context? oldContext = currentContext;
Context? parent = currentContext;
- while (parent != null && parent.isEmpty) parent = parent.parent;
+ while (parent != null && parent.isEmpty) {
+ parent = parent.parent;
+ }
currentContext = Context(node, parent);
if (closures.isThisCaptured && outerMost) {
currentContext!.containsThis = true;
diff --git a/pkg/dart2wasm/lib/code_generator.dart b/pkg/dart2wasm/lib/code_generator.dart
index 113b1bc..56dca65 100644
--- a/pkg/dart2wasm/lib/code_generator.dart
+++ b/pkg/dart2wasm/lib/code_generator.dart
@@ -357,7 +357,7 @@
}
void _implicitReturn() {
- if (function.type.outputs.length > 0) {
+ if (function.type.outputs.isNotEmpty) {
w.ValueType returnType = function.type.outputs[0];
if (returnType is w.RefType && returnType.nullable) {
// Dart body may have an implicit return null.
@@ -706,7 +706,9 @@
}
bool _hasLogicalOperator(Expression condition) {
- while (condition is Not) condition = condition.operand;
+ while (condition is Not) {
+ condition = condition.operand;
+ }
return condition is LogicalExpression;
}
diff --git a/pkg/dart2wasm/lib/dispatch_table.dart b/pkg/dart2wasm/lib/dispatch_table.dart
index 06c6347..9817d7d 100644
--- a/pkg/dart2wasm/lib/dispatch_table.dart
+++ b/pkg/dart2wasm/lib/dispatch_table.dart
@@ -282,7 +282,9 @@
selector.offset = offset;
for (int classId in selector.classIds) {
int entry = offset + classId;
- while (table.length <= entry) table.add(null);
+ while (table.length <= entry) {
+ table.add(null);
+ }
assert(table[entry] == null);
table[entry] = selector.targets[classId];
}
diff --git a/pkg/dart2wasm/lib/intrinsics.dart b/pkg/dart2wasm/lib/intrinsics.dart
index e4d3da9..f7b12e47 100644
--- a/pkg/dart2wasm/lib/intrinsics.dart
+++ b/pkg/dart2wasm/lib/intrinsics.dart
@@ -508,7 +508,7 @@
code(b);
return outType;
}
- } else if (node.arguments.positional.length == 0) {
+ } else if (node.arguments.positional.isEmpty) {
// Unary operator
Expression operand = node.receiver;
w.ValueType opType = translator.translateType(receiverType);
@@ -1010,9 +1010,9 @@
ClassInfo intInfo = translator.classInfo[translator.boxedIntClass]!;
ClassInfo doubleInfo = translator.classInfo[translator.boxedDoubleClass]!;
w.Local cid = function.addLocal(w.NumType.i32);
- w.Label ref_eq = b.block();
+ w.Label refEq = b.block();
b.local_get(first);
- b.br_on_null(ref_eq);
+ b.br_on_null(refEq);
b.struct_get(translator.topInfo.struct, FieldIndex.classId);
b.local_tee(cid);
diff --git a/pkg/dart2wasm/lib/translator.dart b/pkg/dart2wasm/lib/translator.dart
index 50e7b0a..4fe9d4c 100644
--- a/pkg/dart2wasm/lib/translator.dart
+++ b/pkg/dart2wasm/lib/translator.dart
@@ -2,6 +2,8 @@
// 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.
+// ignore_for_file: non_constant_identifier_names
+
import 'dart:typed_data';
import 'package:dart2wasm/class_info.dart';
@@ -540,7 +542,9 @@
}
w.ArrayType arrayTypeForDartType(DartType type) {
- while (type is TypeParameterType) type = type.bound;
+ while (type is TypeParameterType) {
+ type = type.bound;
+ }
return wasmArrayType(
translateStorageType(type), type.toText(defaultAstTextStrategy));
}
diff --git a/pkg/dart2wasm/pubspec.yaml b/pkg/dart2wasm/pubspec.yaml
index f4ed37e..a8cd88a 100644
--- a/pkg/dart2wasm/pubspec.yaml
+++ b/pkg/dart2wasm/pubspec.yaml
@@ -11,3 +11,7 @@
kernel: any
vm: any
wasm_builder: any
+
+# Use 'any' constraints here; we get our versions from the DEPS file.
+dev_dependencies:
+ lints: any