[wasm_builder] enable and fix some new lints
dart_flutter_team_lints is more thorough and used in most ecosystem packages I ignored some of the ones with the most violations Change-Id: I825203b1a60ed44d6190aaa59bfce2a18af8bc82 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473540 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
committed by
Commit Queue
parent
7022754207
commit
a820015bb5
@@ -1 +1,9 @@
|
||||
include: package:lints/recommended.yaml
|
||||
include: package:dart_flutter_team_lints/analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
errors:
|
||||
lines_longer_than_80_chars: ignore
|
||||
omit_local_variable_types: ignore
|
||||
only_throw_errors: ignore
|
||||
prefer_const_constructors: ignore
|
||||
prefer_single_quotes: ignore
|
||||
|
||||
@@ -4,30 +4,30 @@
|
||||
|
||||
import '../ir/ir.dart' as ir;
|
||||
|
||||
export 'data_segments.dart' show DataSegmentsBuilder;
|
||||
export 'data_segment.dart' show DataSegmentBuilder;
|
||||
export 'exports.dart' show ExportsBuilder;
|
||||
export 'globals.dart' show GlobalsBuilder;
|
||||
export 'global.dart' show GlobalBuilder;
|
||||
export 'functions.dart' show FunctionsBuilder;
|
||||
export 'function.dart' show FunctionBuilder;
|
||||
export 'data_segments.dart' show DataSegmentsBuilder;
|
||||
export 'elements.dart' show ElementsBuilder;
|
||||
export 'memories.dart' show MemoriesBuilder;
|
||||
export 'module.dart' show ModuleBuilder;
|
||||
export 'tables.dart' show TablesBuilder;
|
||||
export 'table.dart' show TableBuilder;
|
||||
export 'tags.dart' show TagsBuilder;
|
||||
export 'types.dart' show TypesBuilder;
|
||||
export 'exports.dart' show ExportsBuilder;
|
||||
export 'function.dart' show FunctionBuilder;
|
||||
export 'functions.dart' show FunctionsBuilder;
|
||||
export 'global.dart' show GlobalBuilder;
|
||||
export 'globals.dart' show GlobalsBuilder;
|
||||
export 'instructions.dart'
|
||||
show
|
||||
InstructionsBuilder,
|
||||
Label,
|
||||
ValidationError,
|
||||
TryTableCatch,
|
||||
Catch,
|
||||
CatchAll,
|
||||
CatchAllRef,
|
||||
CatchRef,
|
||||
CatchAllRef;
|
||||
InstructionsBuilder,
|
||||
Label,
|
||||
TryTableCatch,
|
||||
ValidationError;
|
||||
export 'memories.dart' show MemoriesBuilder;
|
||||
export 'module.dart' show ModuleBuilder;
|
||||
export 'table.dart' show TableBuilder;
|
||||
export 'tables.dart' show TablesBuilder;
|
||||
export 'tags.dart' show TagsBuilder;
|
||||
export 'types.dart' show TypesBuilder;
|
||||
|
||||
mixin Builder<T> {
|
||||
T? _built;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
import '../../source_map.dart';
|
||||
import '../ir/ir.dart' as ir;
|
||||
import 'builder.dart';
|
||||
import '../../source_map.dart';
|
||||
|
||||
// TODO(joshualitt): Suggested further optimizations:
|
||||
// 1) Add size estimates to `_Instruction`, and then remove logic where we
|
||||
@@ -319,7 +319,7 @@ class InstructionsBuilder with Builder<ir.Instructions> {
|
||||
}
|
||||
|
||||
/// Marks a region in the instruction stream (defined by instructions emitted
|
||||
/// by [fun]) which will be updated in the link phase via the [linkFun].
|
||||
/// by `fun`) which will be updated in the link phase via the `linkFun`.
|
||||
InstructionsBuilder? createPatchableRegion(
|
||||
List<ir.ValueType> inputs, List<ir.ValueType> outputs) {
|
||||
assert(_verifyTypes(inputs, outputs, trace: ['<patchable region>']));
|
||||
|
||||
@@ -225,7 +225,7 @@ class _RecGroupBuilder {
|
||||
|
||||
final usedGroups = <List<ir.DefType>>[];
|
||||
for (final group in _allRecursiveGroups) {
|
||||
if (group.any((type) => allUsedTypes.contains(type))) {
|
||||
if (group.any(allUsedTypes.contains)) {
|
||||
usedGroups.add(group);
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,7 @@ class _RecursionGroupKey {
|
||||
int get hashCode => Object.hash(groupLength, lengthOfFirstStruct);
|
||||
|
||||
@override
|
||||
bool operator ==(other) {
|
||||
bool operator ==(Object other) {
|
||||
if (other is! _RecursionGroupKey) return false;
|
||||
if (groupLength != other.groupLength) return false;
|
||||
if (lengthOfFirstStruct != other.lengthOfFirstStruct) return false;
|
||||
|
||||
@@ -13,7 +13,7 @@ int _finalizeIndexables(int index, Iterable<ir.Indexable> indexables) {
|
||||
}
|
||||
|
||||
List<T> _finalizeIndexablesAndBuild<T>(
|
||||
int index, Iterable<IndexableBuilder> indexableBuilders) {
|
||||
int index, Iterable<IndexableBuilder<T>> indexableBuilders) {
|
||||
final built = <T>[];
|
||||
for (final f in indexableBuilders) {
|
||||
f.finalizableIndex.finalize(index++);
|
||||
@@ -24,7 +24,7 @@ List<T> _finalizeIndexablesAndBuild<T>(
|
||||
|
||||
/// Finalizes imports before iterating through a list of builders and building.
|
||||
List<T> finalizeImportsAndBuilders<T>(
|
||||
Iterable<ir.Indexable> imported, Iterable<IndexableBuilder> builders) {
|
||||
Iterable<ir.Indexable> imported, Iterable<IndexableBuilder<T>> builders) {
|
||||
int index = _finalizeIndexables(0, imported);
|
||||
return _finalizeIndexablesAndBuild<T>(index, builders);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import 'ir.dart';
|
||||
|
||||
abstract class BaseDataSegment {
|
||||
|
||||
@@ -2,8 +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.
|
||||
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import 'ir.dart';
|
||||
|
||||
/// A local variable defined in a function.
|
||||
|
||||
@@ -2,8 +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.
|
||||
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import 'ir.dart';
|
||||
|
||||
/// An (imported or defined) global variable.
|
||||
|
||||
@@ -25,14 +25,13 @@ class Imports {
|
||||
}
|
||||
|
||||
Imports.deserialized(this.all, this.functions, this.tags, this.globals,
|
||||
this.tables, this.memories) {
|
||||
assert(all.length ==
|
||||
(functions.length +
|
||||
tags.length +
|
||||
globals.length +
|
||||
tables.length +
|
||||
memories.length));
|
||||
}
|
||||
this.tables, this.memories)
|
||||
: assert(all.length ==
|
||||
(functions.length +
|
||||
tags.length +
|
||||
globals.length +
|
||||
tables.length +
|
||||
memories.length));
|
||||
}
|
||||
|
||||
/// Any import (function, table, memory or global).
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import '../../source_map.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import 'ir.dart';
|
||||
|
||||
class Instructions implements Serializable {
|
||||
@@ -27,7 +27,7 @@ class Instructions implements Serializable {
|
||||
/// A string trace.
|
||||
late final trace = _traceLines.join();
|
||||
|
||||
/// Mappings for the instructions in [_instructions] to their source code.
|
||||
/// Mappings for the instructions in `_instructions` to their source code.
|
||||
///
|
||||
/// Since we add mappings as we generate instructions, this will be sorted
|
||||
/// based on [SourceMapping.instructionOffset].
|
||||
|
||||
@@ -6,34 +6,33 @@
|
||||
// TODO(joshualitt): Make all of the ir types full immutable.
|
||||
library;
|
||||
|
||||
export 'data_segments.dart' show DataSegments;
|
||||
export 'data_segment.dart' show BaseDataSegment, DataSegment;
|
||||
export 'data_segments.dart' show DataSegments;
|
||||
export 'element.dart'
|
||||
show
|
||||
ActiveElementSegment,
|
||||
ActiveExpressionElementSegment,
|
||||
ActiveFunctionElementSegment,
|
||||
DeclarativeElementSegment,
|
||||
ElementSegment;
|
||||
export 'elements.dart' show Elements;
|
||||
export 'exports.dart' show Export, Exportable, Exports;
|
||||
export 'finalizable.dart' show Finalizable, FinalizableIndex;
|
||||
export 'indexable.dart' show Indexable;
|
||||
export 'imports.dart' show Import, Imports;
|
||||
export 'globals.dart' show Globals;
|
||||
export 'global.dart' show DefinedGlobal, Global, ImportedGlobal, GlobalExport;
|
||||
export 'functions.dart' show Functions;
|
||||
export 'function.dart'
|
||||
show BaseFunction, DefinedFunction, ImportedFunction, Local, FunctionExport;
|
||||
show BaseFunction, DefinedFunction, FunctionExport, ImportedFunction, Local;
|
||||
export 'functions.dart' show Functions;
|
||||
export 'global.dart' show DefinedGlobal, Global, GlobalExport, ImportedGlobal;
|
||||
export 'globals.dart' show Globals;
|
||||
export 'imports.dart' show Import, Imports;
|
||||
export 'indexable.dart' show Indexable;
|
||||
export 'instruction.dart';
|
||||
export 'instructions.dart' show Instructions;
|
||||
export 'memories.dart' show Memories;
|
||||
export 'memory.dart' show DefinedMemory, ImportedMemory, Memory, MemoryExport;
|
||||
export 'module.dart' show Module;
|
||||
export 'tables.dart' show Tables;
|
||||
export 'elements.dart' show Elements;
|
||||
export 'element.dart'
|
||||
show
|
||||
ElementSegment,
|
||||
ActiveElementSegment,
|
||||
ActiveFunctionElementSegment,
|
||||
ActiveExpressionElementSegment,
|
||||
DeclarativeElementSegment;
|
||||
export 'table.dart' show DefinedTable, ImportedTable, Table, TableExport;
|
||||
export 'tags.dart' show DefinedTag, ImportedTag, Tag, Tags, TagExport;
|
||||
export 'types.dart' show Types;
|
||||
export 'instructions.dart' show Instructions;
|
||||
export 'instruction.dart';
|
||||
export 'tables.dart' show Tables;
|
||||
export 'tags.dart' show DefinedTag, ImportedTag, Tag, TagExport, Tags;
|
||||
export 'type.dart'
|
||||
show
|
||||
ArrayType,
|
||||
@@ -49,3 +48,4 @@ export 'type.dart'
|
||||
StorageType,
|
||||
StructType,
|
||||
ValueType;
|
||||
export 'types.dart' show Types;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import 'ir.dart';
|
||||
|
||||
/// A logically const wasm module ready to encode. Created with `ModuleBuilder`.
|
||||
|
||||
@@ -2,8 +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.
|
||||
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import 'ir.dart';
|
||||
|
||||
/// An (imported or defined) table.
|
||||
|
||||
@@ -2,8 +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.
|
||||
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
import 'ir.dart';
|
||||
|
||||
/// An exported tag from the current module.
|
||||
|
||||
@@ -2,8 +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.
|
||||
|
||||
import '../serialize/serialize.dart';
|
||||
import '../serialize/printer.dart';
|
||||
import '../serialize/serialize.dart';
|
||||
|
||||
// Representations of all Wasm types.
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Deserializer {
|
||||
} while ((byte & 0x80) != 0);
|
||||
|
||||
if ((shift < 64) && ((byte & 0x40) != 0)) {
|
||||
result |= (~0 << shift);
|
||||
result |= ~0 << shift;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -2,8 +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.
|
||||
|
||||
import 'dart:typed_data';
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../ir/ir.dart' as ir;
|
||||
|
||||
@@ -209,7 +209,7 @@ class ModulePrinter {
|
||||
mp.writeln('(module \$${_module.moduleName}');
|
||||
mp.withIndent(() {
|
||||
final groups = _module.types.recursionGroups
|
||||
.where((group) => group.any((t) => _types.containsKey(t)))
|
||||
.where((group) => group.any(_types.containsKey))
|
||||
.toList();
|
||||
if (settings.printInSortedOrder) {
|
||||
groups.sort((a, b) {
|
||||
@@ -228,7 +228,7 @@ class ModulePrinter {
|
||||
}
|
||||
|
||||
for (final group in groups) {
|
||||
final filtered = group.where((t) => _types.containsKey(t)).toList();
|
||||
final filtered = group.where(_types.containsKey).toList();
|
||||
if (filtered.isNotEmpty) {
|
||||
if (filtered.length == 1) {
|
||||
mp.write(_types[filtered.single]!);
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
// 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.
|
||||
|
||||
export 'serializer.dart' show Serializable, Serializer;
|
||||
export 'deserializer.dart' show Deserializer;
|
||||
export 'sections.dart';
|
||||
export 'serializer.dart' show Serializable, Serializer;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.
|
||||
|
||||
export 'src/ir/ir.dart'
|
||||
hide Catch, CatchAll, CatchRef, CatchAllRef, TryTableCatch;
|
||||
export 'src/builder/builder.dart';
|
||||
export 'src/ir/ir.dart'
|
||||
hide Catch, CatchAll, CatchAllRef, CatchRef, TryTableCatch;
|
||||
export 'src/serialize/serialize.dart';
|
||||
|
||||
Reference in New Issue
Block a user