mirror of
https://github.com/dart-lang/sdk
synced 2024-10-01 18:49:24 +00:00
[pkg/wasm_builder] use package:lints/recommended.yaml
Change-Id: Id5bda808afbc2404e7fdd2586c64dfe9521f5be3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282382 Commit-Queue: Devon Carew <devoncarew@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com>
This commit is contained in:
parent
a4314c93e0
commit
1dcb466924
|
@ -1 +1 @@
|
|||
include: package:lints/core.yaml
|
||||
include: package:lints/recommended.yaml
|
||||
|
|
|
@ -50,6 +50,7 @@ class Expression extends Label {
|
|||
localInitializationStackHeight = 0;
|
||||
}
|
||||
|
||||
@override
|
||||
List<ValueType> get targetTypes => outputs;
|
||||
}
|
||||
|
||||
|
@ -57,6 +58,7 @@ class Block extends Label {
|
|||
Block(List<ValueType> inputs, List<ValueType> outputs)
|
||||
: super._(inputs, outputs);
|
||||
|
||||
@override
|
||||
List<ValueType> get targetTypes => outputs;
|
||||
}
|
||||
|
||||
|
@ -64,6 +66,7 @@ class Loop extends Label {
|
|||
Loop(List<ValueType> inputs, List<ValueType> outputs)
|
||||
: super._(inputs, outputs);
|
||||
|
||||
@override
|
||||
List<ValueType> get targetTypes => inputs;
|
||||
}
|
||||
|
||||
|
@ -73,6 +76,7 @@ class If extends Label {
|
|||
If(List<ValueType> inputs, List<ValueType> outputs)
|
||||
: super._(inputs, outputs);
|
||||
|
||||
@override
|
||||
List<ValueType> get targetTypes => outputs;
|
||||
}
|
||||
|
||||
|
@ -82,6 +86,7 @@ class Try extends Label {
|
|||
Try(List<ValueType> inputs, List<ValueType> outputs)
|
||||
: super._(inputs, outputs);
|
||||
|
||||
@override
|
||||
List<ValueType> get targetTypes => outputs;
|
||||
}
|
||||
|
||||
|
@ -186,9 +191,9 @@ class Instructions with SerializerMixin {
|
|||
_indent += indentBefore;
|
||||
String byteOffset =
|
||||
byteOffsetEnabled ? "${data.length}".padLeft(byteOffsetWidth) : "";
|
||||
String instr = " " * _indent + " " + trace.join(" ");
|
||||
String instr = "${" " * _indent} ${trace.join(" ")}";
|
||||
instr = instr.length > instructionColumnWidth - 2
|
||||
? instr.substring(0, instructionColumnWidth - 4) + "... "
|
||||
? "${instr.substring(0, instructionColumnWidth - 4)}... "
|
||||
: instr.padRight(instructionColumnWidth);
|
||||
final int stackHeight = _stackTypes.length;
|
||||
final String stack = reachableAfter
|
||||
|
@ -210,9 +215,8 @@ class Instructions with SerializerMixin {
|
|||
|
||||
bool _comment(String text) {
|
||||
if (traceEnabled) {
|
||||
final String line = " " * (byteOffsetEnabled ? byteOffsetWidth : 0) +
|
||||
" " * _indent +
|
||||
" ;; $text\n";
|
||||
final String line = "${" " * (byteOffsetEnabled ? byteOffsetWidth : 0)}"
|
||||
"${" " * _indent} ;; $text\n";
|
||||
_traceLines.add(line);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -14,7 +14,7 @@ import 'types.dart';
|
|||
class Module with SerializerMixin {
|
||||
final List<int>? watchPoints;
|
||||
|
||||
final Map<_FunctionTypeKey, FunctionType> functionTypeMap = {};
|
||||
final Map<_FunctionTypeKey, FunctionType> _functionTypeMap = {};
|
||||
|
||||
final List<DefType> defTypes = [];
|
||||
final List<int> recursionGroupSplits = [];
|
||||
|
@ -86,7 +86,7 @@ class Module with SerializerMixin {
|
|||
final List<ValueType> inputList = List.unmodifiable(inputs);
|
||||
final List<ValueType> outputList = List.unmodifiable(outputs);
|
||||
final _FunctionTypeKey key = _FunctionTypeKey(inputList, outputList);
|
||||
return functionTypeMap.putIfAbsent(key, () {
|
||||
return _functionTypeMap.putIfAbsent(key, () {
|
||||
final type = FunctionType(inputList, outputList, superType: superType)
|
||||
..index = defTypes.length;
|
||||
defTypes.add(type);
|
||||
|
@ -515,6 +515,7 @@ class Tag implements Serializable {
|
|||
s.write(type);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => "#$index";
|
||||
}
|
||||
|
||||
|
@ -597,7 +598,9 @@ abstract class Import implements Serializable {
|
|||
|
||||
/// An imported function.
|
||||
class ImportedFunction extends BaseFunction implements Import {
|
||||
@override
|
||||
final String module;
|
||||
@override
|
||||
final String name;
|
||||
|
||||
ImportedFunction(this.module, this.name, super.index, super.type,
|
||||
|
@ -617,7 +620,9 @@ class ImportedFunction extends BaseFunction implements Import {
|
|||
|
||||
/// An imported table.
|
||||
class ImportedTable extends Table implements Import {
|
||||
@override
|
||||
final String module;
|
||||
@override
|
||||
final String name;
|
||||
|
||||
ImportedTable(this.module, this.name, super.index, super.type, super.minSize,
|
||||
|
@ -634,7 +639,9 @@ class ImportedTable extends Table implements Import {
|
|||
|
||||
/// An imported memory.
|
||||
class ImportedMemory extends Memory implements Import {
|
||||
@override
|
||||
final String module;
|
||||
@override
|
||||
final String name;
|
||||
|
||||
ImportedMemory(this.module, this.name, super.index, super.shared,
|
||||
|
@ -651,7 +658,9 @@ class ImportedMemory extends Memory implements Import {
|
|||
|
||||
/// An imported global variable.
|
||||
class ImportedGlobal extends Global implements Import {
|
||||
@override
|
||||
final String module;
|
||||
@override
|
||||
final String name;
|
||||
|
||||
ImportedGlobal(this.module, this.name, super.index, super.type);
|
||||
|
@ -728,6 +737,7 @@ abstract class Section with SerializerMixin implements Serializable {
|
|||
|
||||
Section(this.module);
|
||||
|
||||
@override
|
||||
void serialize(Serializer s) {
|
||||
if (isNotEmpty) {
|
||||
serializeContents();
|
||||
|
|
|
@ -51,6 +51,7 @@ mixin SerializerMixin implements Serializer {
|
|||
_traces[_index] ??= data;
|
||||
}
|
||||
|
||||
@override
|
||||
void writeByte(int byte) {
|
||||
if (traceEnabled) _debugTrace(StackTrace.current);
|
||||
assert(byte == byte & 0xFF);
|
||||
|
@ -58,12 +59,14 @@ mixin SerializerMixin implements Serializer {
|
|||
_data[_index++] = byte;
|
||||
}
|
||||
|
||||
@override
|
||||
void writeBytes(List<int> bytes) {
|
||||
if (traceEnabled) _debugTrace(StackTrace.current);
|
||||
_ensure(bytes.length);
|
||||
_data.setRange(_index, _index += bytes.length, bytes);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeSigned(int value) {
|
||||
while (value < -0x40 || value >= 0x40) {
|
||||
writeByte((value & 0x7F) | 0x80);
|
||||
|
@ -72,6 +75,7 @@ mixin SerializerMixin implements Serializer {
|
|||
writeByte(value & 0x7F);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeUnsigned(int value) {
|
||||
assert(value >= 0);
|
||||
while (value >= 0x80) {
|
||||
|
@ -81,6 +85,7 @@ mixin SerializerMixin implements Serializer {
|
|||
writeByte(value);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeF32(double value) {
|
||||
// Get the binary representation of the F32.
|
||||
List<int> bytes = Float32List.fromList([value]).buffer.asUint8List();
|
||||
|
@ -89,6 +94,7 @@ mixin SerializerMixin implements Serializer {
|
|||
writeBytes(bytes);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeF64(double value) {
|
||||
// Get the binary representation of the F64.
|
||||
List<int> bytes = Float64List.fromList([value]).buffer.asUint8List();
|
||||
|
@ -97,16 +103,19 @@ mixin SerializerMixin implements Serializer {
|
|||
writeBytes(bytes);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeName(String name) {
|
||||
List<int> bytes = utf8.encode(name);
|
||||
writeUnsigned(bytes.length);
|
||||
writeBytes(bytes);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(Serializable object) {
|
||||
object.serialize(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void writeList(List<Serializable> objects) {
|
||||
writeUnsigned(objects.length);
|
||||
for (int i = 0; i < objects.length; i++) {
|
||||
|
@ -114,6 +123,7 @@ mixin SerializerMixin implements Serializer {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void writeData(Serializer chunk, [List<int>? watchPoints]) {
|
||||
if (traceEnabled) _debugTrace(chunk);
|
||||
if (watchPoints != null) {
|
||||
|
@ -137,5 +147,6 @@ mixin SerializerMixin implements Serializer {
|
|||
writeBytes(chunk.data);
|
||||
}
|
||||
|
||||
@override
|
||||
Uint8List get data => Uint8List.sublistView(_data, 0, _index);
|
||||
}
|
||||
|
|
|
@ -134,10 +134,11 @@ class RefType extends ValueType {
|
|||
final HeapType heapType;
|
||||
|
||||
/// The nullability of this reference type.
|
||||
@override
|
||||
final bool nullable;
|
||||
|
||||
RefType(this.heapType, {bool? nullable})
|
||||
: this.nullable = nullable ??
|
||||
: nullable = nullable ??
|
||||
heapType.nullableByDefault ??
|
||||
(throw "Unspecified nullability");
|
||||
|
||||
|
|
Loading…
Reference in a new issue