Skip to content

Commit 60d4180

Browse files
nshahanCommit Queue
authored andcommitted
[ddc] Bump language version to 3.8
* Reformat pkg/dev_compiler. * Re-flow some comments to keep them within 80 characters. Change-Id: I0849ce113ecf3dce4a2b4405c2b09a17dee4df76 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433081 Reviewed-by: Mark Zhou <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]>
1 parent 6697075 commit 60d4180

File tree

84 files changed

+12678
-7820
lines changed

Some content is hidden

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

84 files changed

+12678
-7820
lines changed

pkg/dev_compiler/lib/ddc.dart

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ Future internalMain(List<String> args, [SendPort? sendPort]) async {
3838
var batch = _BatchHelper();
3939
await batch._runBatch(parsedArgs);
4040
} else if (parsedArgs.isExpressionCompiler) {
41-
await ExpressionCompilerWorker.createAndStart(parsedArgs.rest,
42-
sendPort: sendPort);
41+
await ExpressionCompilerWorker.createAndStart(
42+
parsedArgs.rest,
43+
sendPort: sendPort,
44+
);
4345
} else {
4446
var result = await compile(parsedArgs);
4547
exitCode = result.exitCode;
@@ -52,7 +54,7 @@ class _CompilerWorker extends AsyncWorkerLoop {
5254
final ParsedArguments _startupArgs;
5355

5456
_CompilerWorker(this._startupArgs, AsyncWorkerConnection workerConnection)
55-
: super(connection: workerConnection);
57+
: super(connection: workerConnection);
5658

5759
/// Keeps track of our last compilation result so it can potentially be
5860
/// re-used in a worker.
@@ -72,12 +74,17 @@ class _CompilerWorker extends AsyncWorkerLoop {
7274
}
7375

7476
lastResult = await runZoned(
75-
() => compile(args,
76-
compilerState: context?.kernelState, inputDigests: inputDigests),
77-
zoneSpecification:
78-
ZoneSpecification(print: (self, parent, zone, message) {
79-
output.writeln(message.toString());
80-
}));
77+
() => compile(
78+
args,
79+
compilerState: context?.kernelState,
80+
inputDigests: inputDigests,
81+
),
82+
zoneSpecification: ZoneSpecification(
83+
print: (self, parent, zone, message) {
84+
output.writeln(message.toString());
85+
},
86+
),
87+
);
8188
return WorkResponse()
8289
..exitCode = lastResult!.success ? 0 : 1
8390
..output = output.toString();
@@ -108,10 +115,13 @@ class _BatchHelper {
108115
Future _runBatch(ParsedArguments batchArgs) async {
109116
_workaroundForLeakingBug();
110117
if (leakTesting) {
111-
var services =
112-
await Service.controlWebServer(enable: true, silenceOutput: true);
113-
File.fromUri(Directory.systemTemp.uri.resolve('./dart_leak_test_uri'))
114-
.writeAsStringSync(services.serverUri!.toString());
118+
var services = await Service.controlWebServer(
119+
enable: true,
120+
silenceOutput: true,
121+
);
122+
File.fromUri(
123+
Directory.systemTemp.uri.resolve('./dart_leak_test_uri'),
124+
).writeAsStringSync(services.serverUri!.toString());
115125
}
116126

117127
watch.start();
@@ -164,12 +174,18 @@ class _BatchHelper {
164174
void _workaroundForLeakingBug() {
165175
try {
166176
stdin.echoMode;
167-
} catch (e) {/**/}
177+
} catch (e) {
178+
/**/
179+
}
168180
try {
169181
stdout.writeln();
170-
} catch (e) {/**/}
182+
} catch (e) {
183+
/**/
184+
}
171185
try {
172186
stderr.writeln();
173-
} catch (e) {/**/}
187+
} catch (e) {
188+
/**/
189+
}
174190
}
175191
}

pkg/dev_compiler/lib/src/command/arguments.dart

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ class ParsedArguments {
5959
this.isExpressionCompiler = false,
6060
});
6161

62-
/// Preprocess arguments to determine whether DDK is used in batch mode or as a
63-
/// persistent worker.
62+
/// Preprocess arguments to determine whether DDK is used in batch mode or as
63+
/// a persistent worker.
6464
///
6565
/// When used in batch mode, we expect a `--batch` parameter.
6666
///
6767
/// When used as a persistent bazel worker, the `--persistent_worker` might be
68-
/// present, and an argument of the form `@path/to/file` might be provided. The
69-
/// latter needs to be replaced by reading all the contents of the
70-
/// file and expanding them into the resulting argument list.
68+
/// present, and an argument of the form `@path/to/file` might be provided.
69+
/// The `@latter needs to be replaced by reading all the contents of the file
70+
/// and expanding them into the resulting argument list.
7171
factory ParsedArguments.from(List<String> args) {
7272
if (args.isEmpty) return ParsedArguments._(args);
7373

@@ -101,12 +101,14 @@ class ParsedArguments {
101101
newArgs.add(arg);
102102
}
103103
}
104-
return ParsedArguments._(newArgs,
105-
isWorker: isWorker,
106-
isBatch: isBatch,
107-
reuseResult: reuseResult,
108-
useIncrementalCompiler: useIncrementalCompiler,
109-
isExpressionCompiler: isExpressionCompiler);
104+
return ParsedArguments._(
105+
newArgs,
106+
isWorker: isWorker,
107+
isBatch: isBatch,
108+
reuseResult: reuseResult,
109+
useIncrementalCompiler: useIncrementalCompiler,
110+
isExpressionCompiler: isExpressionCompiler,
111+
);
110112
}
111113

112114
/// Whether the compiler is running in [isBatch] or [isWorker] mode.
@@ -128,12 +130,14 @@ class ParsedArguments {
128130
if (newArgs.isBatchOrWorker) {
129131
throw ArgumentError('cannot change batch or worker mode after startup.');
130132
}
131-
return ParsedArguments._(rest.toList()..addAll(newArgs.rest),
132-
isWorker: isWorker,
133-
isBatch: isBatch,
134-
reuseResult: reuseResult || newArgs.reuseResult,
135-
useIncrementalCompiler:
136-
useIncrementalCompiler || newArgs.useIncrementalCompiler);
133+
return ParsedArguments._(
134+
rest.toList()..addAll(newArgs.rest),
135+
isWorker: isWorker,
136+
isBatch: isBatch,
137+
reuseResult: reuseResult || newArgs.reuseResult,
138+
useIncrementalCompiler:
139+
useIncrementalCompiler || newArgs.useIncrementalCompiler,
140+
);
137141
}
138142
}
139143

0 commit comments

Comments
 (0)