Skip to content

Commit 4ee6a66

Browse files
mkustermannCommit Queue
authored andcommitted
[dart2wasm] Format pkg/dart2wasm after language version was increased
The change in [0] increased the language version of pkg/dart2wasm. That in return changes how the package is formatted by the autoformatter. This CL runs now the formatter to re-format the code. Unfortunately this makes blame lists worse. But not doing it will make us have to disable auto-formatting before saving files which is very annoying. [0] https://dart-review.googlesource.com/c/sdk/+/487944 Change-Id: I6953fe0d6a824b2b79a26bbadb0bb977cec70b7a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490821 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
1 parent 95c1a0d commit 4ee6a66

74 files changed

Lines changed: 10514 additions & 5771 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pkg/dart2wasm/benchmark/filesystem_js.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class WasmCompilerFileSystem extends WasmCompilerFileSystemBase {
3434
if (isJSShell) {
3535
return jsshellWrite(path, bytes.toJS);
3636
}
37-
final buffer =
38-
(Uint8List(bytes.length)..setRange(0, bytes.length, bytes)).buffer;
37+
final buffer = (Uint8List(
38+
bytes.length,
39+
)..setRange(0, bytes.length, bytes)).buffer;
3940
if (isD8) {
4041
return d8Write(path, buffer.toJS);
4142
}

pkg/dart2wasm/benchmark/self_compile_benchmark.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class _BenchmarkIOManager extends CompilerPhaseInputOutputManager {
1616
Uint8List? moduleBytes;
1717

1818
_BenchmarkIOManager(this.benchmarkFileSystem, WasmCompilerOptions options)
19-
: super(benchmarkFileSystem, options);
19+
: super(benchmarkFileSystem, options);
2020

2121
@override
2222
Future<void> writeWasmModule(Uint8List wasmModule, String moduleName) async {
@@ -46,8 +46,9 @@ Future main(List<String> args) async {
4646
final options = WasmCompilerOptions(mainUri: main, outputFile: 'out.wasm');
4747
final ioManager = _BenchmarkIOManager(fileSystem, options);
4848

49-
options.librariesSpecPath =
50-
Uri.file('${fileSystem.sdkRoot}/sdk/lib/libraries.json');
49+
options.librariesSpecPath = Uri.file(
50+
'${fileSystem.sdkRoot}/sdk/lib/libraries.json',
51+
);
5152

5253
await compileBenchmark(options, ioManager);
5354
print('Dart2WasmSelfCompile(RunTimeRaw): ${sw.elapsed.inMilliseconds} ms.');
@@ -58,8 +59,10 @@ Future main(List<String> args) async {
5859
}
5960
}
6061

61-
Future<CodegenResult> compileBenchmark(WasmCompilerOptions options,
62-
CompilerPhaseInputOutputManager ioManager) async {
62+
Future<CodegenResult> compileBenchmark(
63+
WasmCompilerOptions options,
64+
CompilerPhaseInputOutputManager ioManager,
65+
) async {
6366
// Avoid CFE self-detecting whether `stdout`/`stderr` is terminal and supports
6467
// colors (as we don't have `dart:io` available when we run dart2wasm in a
6568
// wasm runtime).

pkg/dart2wasm/bin/wasm2wat.dart

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ void main(List<String> args) {
2222
final outputFile = result['output'] as String?;
2323
final wasmFiles = result.rest;
2424
if (outputFile != null && wasmFiles.length != 1) {
25-
print('Specified --output=$outputFile but number of wasm files is not 1 '
26-
'(${wasmFiles.join(' ')})');
25+
print(
26+
'Specified --output=$outputFile but number of wasm files is not 1 '
27+
'(${wasmFiles.join(' ')})',
28+
);
2729
print(argParser.usage);
2830
exit(1);
2931
}
@@ -47,10 +49,11 @@ void main(List<String> args) {
4749
final typeFilters = getFilter('type-name-filter');
4850
final globalFilters = getFilter('global-name-filter');
4951
final settings = ModulePrintSettings(
50-
functionFilters: functionFilters,
51-
typeFilters: typeFilters,
52-
globalFilters: globalFilters,
53-
printInSortedOrder: sort);
52+
functionFilters: functionFilters,
53+
typeFilters: typeFilters,
54+
globalFilters: globalFilters,
55+
printInSortedOrder: sort,
56+
);
5457

5558
for (final input in wasmFiles) {
5659
final wasmBytes = File(input).readAsBytesSync();
@@ -71,31 +74,49 @@ void main(List<String> args) {
7174
}
7275

7376
final argParser = ArgParser()
74-
..addMultiOption('function-name-filter',
75-
abbr: 'f',
76-
help: 'Only print function bodies if the function name matches. '
77-
'The name filter is interpreted as a Dart `RegExp`.')
78-
..addMultiOption('type-name-filter',
79-
abbr: 't',
80-
help: 'Only print type constituents if the type name matches. '
81-
'The name filter is interpreted as a Dart `RegExp`.')
82-
..addMultiOption('global-name-filter',
83-
abbr: 'g',
84-
help: 'Only print global initializers if the global name matches. '
85-
'The name filter is interpreted as a Dart `RegExp`.')
86-
..addFlag('sort',
87-
abbr: 's',
88-
help: 'Print functions/types/... in sorted order (sort by name).')
89-
..addFlag('write',
90-
abbr: 'w', help: 'Write the resulting wat code to <input.wasm>.wat.')
77+
..addMultiOption(
78+
'function-name-filter',
79+
abbr: 'f',
80+
help:
81+
'Only print function bodies if the function name matches. '
82+
'The name filter is interpreted as a Dart `RegExp`.',
83+
)
84+
..addMultiOption(
85+
'type-name-filter',
86+
abbr: 't',
87+
help:
88+
'Only print type constituents if the type name matches. '
89+
'The name filter is interpreted as a Dart `RegExp`.',
90+
)
91+
..addMultiOption(
92+
'global-name-filter',
93+
abbr: 'g',
94+
help:
95+
'Only print global initializers if the global name matches. '
96+
'The name filter is interpreted as a Dart `RegExp`.',
97+
)
98+
..addFlag(
99+
'sort',
100+
abbr: 's',
101+
help: 'Print functions/types/... in sorted order (sort by name).',
102+
)
103+
..addFlag(
104+
'write',
105+
abbr: 'w',
106+
help: 'Write the resulting wat code to <input.wasm>.wat.',
107+
)
91108
..addFlag('help', abbr: 'h', help: 'Print the help of this tool.')
92-
..addFlag('prefer-multiline',
93-
abbr: 'm',
94-
help:
95-
'Prefer to print global initializers & type definitions as multi line.',
96-
defaultsTo: /* wami equivalent is false */ false)
97-
..addOption('output',
98-
abbr: 'o',
99-
help:
100-
'The filepath where the output will be written to (default: stdout). '
101-
'The number of input wasm files must be 1 if --output was provided.');
109+
..addFlag(
110+
'prefer-multiline',
111+
abbr: 'm',
112+
help:
113+
'Prefer to print global initializers & type definitions as multi line.',
114+
defaultsTo: /* wami equivalent is false */ false,
115+
)
116+
..addOption(
117+
'output',
118+
abbr: 'o',
119+
help:
120+
'The filepath where the output will be written to (default: stdout). '
121+
'The number of input wasm files must be 1 if --output was provided.',
122+
);

0 commit comments

Comments
 (0)