Skip to content

Commit 08092d1

Browse files
fishythefishCommit Queue
authored andcommitted
[dart2js_info] Update pubspec to 3.8 and reformat.
Change-Id: I21a79df1900038fa4dbed97c085a64bdcf4b4156 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427580 Auto-Submit: Mayank Patke <[email protected]> Commit-Queue: Nate Biggs <[email protected]> Reviewed-by: Nate Biggs <[email protected]>
1 parent f1c89d6 commit 08092d1

File tree

10 files changed

+94
-109
lines changed

10 files changed

+94
-109
lines changed

pkg/dart2js_info/bin/src/coverage_log_server.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,9 @@ class _Server {
157157
if (urlPath == prefix ||
158158
urlPath == '$prefix/' ||
159159
urlPath == _expectedPath(baseHtmlName)) {
160-
var contents =
161-
htmlPath == null
162-
? '<html><script src="$baseJsName"></script>'
163-
: await File(htmlPath!).readAsString();
160+
var contents = htmlPath == null
161+
? '<html><script src="$baseJsName"></script>'
162+
: await File(htmlPath!).readAsString();
164163
return shelf.Response.ok(contents, headers: _htmlHeaders);
165164
}
166165

@@ -222,7 +221,8 @@ String _normalize(String uriPath) {
222221

223222
String _adjustRequestUrl(String code, String prefix) {
224223
var url = prefix == '' ? 'coverage' : '$prefix/coverage';
225-
var hook = '''
224+
var hook =
225+
'''
226226
self.dartCallInstrumentation = function(id, name) {
227227
if (!this.traceBuffer) {
228228
this.traceBuffer = [];

pkg/dart2js_info/bin/src/deferred_library_layout.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ Future<void> _showLayout(String file) async {
6464
print(' contains:');
6565
map.forEach((lib, elements) {
6666
final uri = lib.uri;
67-
final shortUri =
68-
(uri.isScheme('file') && uri.path.startsWith(dir))
69-
? uri.path.substring(dir.length + 1)
70-
: '$uri';
67+
final shortUri = (uri.isScheme('file') && uri.path.startsWith(dir))
68+
? uri.path.substring(dir.length + 1)
69+
: '$uri';
7170

7271
// If the entire library is in one chunk, just report the library name
7372
// otherwise report which functions are on this chunk.

pkg/dart2js_info/bin/src/library_size_split.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ class LibrarySizeCommand extends Command<void> with PrintUsageException {
9696
final info = await infoFromFile(args.first);
9797

9898
final groupingFile = argRes['grouping'];
99-
final groupingText =
100-
groupingFile != null
101-
? File(groupingFile).readAsStringSync()
102-
: defaultGrouping;
99+
final groupingText = groupingFile != null
100+
? File(groupingFile).readAsStringSync()
101+
: defaultGrouping;
103102
final groupingYaml = loadYaml(groupingText);
104103
final groups = [];
105104
for (var group in groupingYaml['groups']) {
@@ -145,10 +144,9 @@ class LibrarySizeCommand extends Command<void> with PrintUsageException {
145144
return;
146145
}
147146

148-
var percent =
149-
row.value == realTotal
150-
? '100'
151-
: (row.value * 100 / realTotal).toStringAsFixed(2);
147+
var percent = row.value == realTotal
148+
? '100'
149+
: (row.value * 100 / realTotal).toStringAsFixed(2);
152150
print(
153151
' ${_pad(row.label, longest + 1, right: true)}'
154152
' ${_pad(row.value, 8)} ${_pad(percent, 6)}%',
@@ -223,7 +221,8 @@ String _pad(Object value, int n, {bool right = false}) {
223221
/// Default grouping specification that includes an entry per library, and
224222
/// grouping entries for each package, all packages, all core libs, and loose
225223
/// files.
226-
final defaultGrouping = """
224+
final defaultGrouping =
225+
"""
227226
groups:
228227
- { name: "Loose files", regexp: "file://.*", cluster: 2}
229228
- { name: "All packages", regexp: "package:.*", cluster: 2}

pkg/dart2js_info/bin/src/runtime_coverage_analysis.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,18 @@ Future<void> _reportWithPackages(String infoFile, String coverageFile) async {
241241
'${packageInfo.unusedSize}/$unusedTotal ($unusedCodeRatioString%)',
242242
);
243243

244-
var mainUnitPackageRatioString = (packageInfo.mainUnitSize /
245-
packageInfo.totalSize *
246-
100)
247-
.toStringAsFixed(2);
244+
var mainUnitPackageRatioString =
245+
(packageInfo.mainUnitSize / packageInfo.totalSize * 100)
246+
.toStringAsFixed(2);
248247
_leftPadded(
249248
' proportion of main unit code to package code:',
250249
'${packageInfo.mainUnitSize}/${packageInfo.totalSize} '
251250
'($mainUnitPackageRatioString%)',
252251
);
253252

254-
var unusedMainUnitRatioString = (packageInfo.unusedMainUnitSize /
255-
packageInfo.mainUnitSize *
256-
100)
257-
.toStringAsFixed(2);
253+
var unusedMainUnitRatioString =
254+
(packageInfo.unusedMainUnitSize / packageInfo.mainUnitSize * 100)
255+
.toStringAsFixed(2);
258256
_leftPadded(
259257
' proportion of main unit code that is unused:',
260258
'${packageInfo.unusedMainUnitSize}/${packageInfo.mainUnitSize} '

pkg/dart2js_info/lib/json_info_codec.dart

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
6969

7070
input['dependencies']?.forEach((String k, dependencies) {
7171
List<String> deps = dependencies;
72-
result.dependencies[registry[k]!] =
73-
deps.map((d) => registry[d]!).toList();
72+
result.dependencies[registry[k]!] = deps
73+
.map((d) => registry[d]!)
74+
.toList();
7475
});
7576

7677
result.outputUnits.addAll(
@@ -80,8 +81,8 @@ class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
8081
result.program = parseProgram(input['program']);
8182

8283
if (input['deferredFiles'] != null) {
83-
final deferredFilesMap =
84-
(input['deferredFiles'] as Map).cast<String, Map<String, dynamic>>();
84+
final deferredFilesMap = (input['deferredFiles'] as Map)
85+
.cast<String, Map<String, dynamic>>();
8586
for (final library in deferredFilesMap.values) {
8687
if (library['imports'] != null) {
8788
// The importMap needs to be typed as <String, List<String>>, but the
@@ -181,10 +182,9 @@ class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
181182
..code = parseCode(json['code'])
182183
..isConst = json['const'] ?? false
183184
..initializer = parseId(json['initializer']) as ConstantInfo?
184-
..closures =
185-
(json['children'] as List)
186-
.map<ClosureInfo>((c) => parseId(c) as ClosureInfo)
187-
.toList();
185+
..closures = (json['children'] as List)
186+
.map<ClosureInfo>((c) => parseId(c) as ClosureInfo)
187+
.toList();
188188
}
189189

190190
ConstantInfo parseConstant(Map json) {
@@ -208,22 +208,19 @@ class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
208208
ProgramInfo parseProgram(Map json) {
209209
// TODO(het): Revert this when the dart2js with the new codec is in stable
210210
final compilationDuration = json['compilationDuration'];
211-
final compilationDurationParsed =
212-
compilationDuration is String
213-
? _parseDuration(compilationDuration)
214-
: Duration(microseconds: compilationDuration as int);
211+
final compilationDurationParsed = compilationDuration is String
212+
? _parseDuration(compilationDuration)
213+
: Duration(microseconds: compilationDuration as int);
215214

216215
final toJsonDuration = json['toJsonDuration'];
217-
final toJsonDurationParsed =
218-
toJsonDuration is String
219-
? _parseDuration(toJsonDuration)
220-
: Duration(microseconds: toJsonDuration as int);
216+
final toJsonDurationParsed = toJsonDuration is String
217+
? _parseDuration(toJsonDuration)
218+
: Duration(microseconds: toJsonDuration as int);
221219

222220
final dumpInfoDuration = json['dumpInfoDuration'];
223-
final dumpInfoDurationParsed =
224-
dumpInfoDuration is String
225-
? _parseDuration(dumpInfoDuration)
226-
: Duration(microseconds: dumpInfoDuration as int);
221+
final dumpInfoDurationParsed = dumpInfoDuration is String
222+
? _parseDuration(dumpInfoDuration)
223+
: Duration(microseconds: dumpInfoDuration as int);
227224

228225
final programInfo = ProgramInfo(
229226
entrypoint: parseId(json['entrypoint']) as FunctionInfo,
@@ -276,16 +273,16 @@ class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
276273
..type = json['type']
277274
..returnType = json['returnType']
278275
..inferredReturnType = json['inferredReturnType']
279-
..parameters =
280-
(json['parameters'] as List).map((p) => parseParameter(p)).toList()
276+
..parameters = (json['parameters'] as List)
277+
.map((p) => parseParameter(p))
278+
.toList()
281279
..code = parseCode(json['code'])
282280
..sideEffects = json['sideEffects']
283281
..inlinedCount = json['inlinedCount']
284282
..modifiers = parseModifiers(Map<String, bool>.from(json['modifiers']))
285-
..closures =
286-
(json['children'] as List)
287-
.map<ClosureInfo>((c) => parseId(c) as ClosureInfo)
288-
.toList();
283+
..closures = (json['children'] as List)
284+
.map<ClosureInfo>((c) => parseId(c) as ClosureInfo)
285+
.toList();
289286
}
290287

291288
ParameterInfo parseParameter(Map json) =>
@@ -450,10 +447,9 @@ class AllInfoToJsonConverter extends Converter<AllInfo, Map>
450447
var map = SplayTreeMap<String, List<Map<String, dynamic>>>(compareNatural);
451448
void helper(CodeInfo info) {
452449
if (info.uses.isEmpty) return;
453-
map[idFor(info).serializedId] =
454-
SplayTreeSet.of(
455-
info.uses.map(_createFromDepInfo),
456-
).map((e) => e.toJson()).toList();
450+
map[idFor(info).serializedId] = SplayTreeSet.of(
451+
info.uses.map(_createFromDepInfo),
452+
).map((e) => e.toJson()).toList();
457453
}
458454

459455
allInfo.functions.forEach(helper);
@@ -557,12 +553,13 @@ class AllInfoToJsonConverter extends Converter<AllInfo, Map>
557553

558554
@override
559555
Map visitField(FieldInfo info) {
560-
var result = _visitBasicInfo(info)..addAll(<String, Object>{
561-
'children': _toSortedSerializedIds(info.closures, idFor),
562-
'inferredType': info.inferredType,
563-
'code': _serializeCode(info.code),
564-
'type': info.type,
565-
});
556+
var result = _visitBasicInfo(info)
557+
..addAll(<String, Object>{
558+
'children': _toSortedSerializedIds(info.closures, idFor),
559+
'inferredType': info.inferredType,
560+
'code': _serializeCode(info.code),
561+
'type': info.type,
562+
});
566563
if (info.isConst) {
567564
result['const'] = true;
568565
if (info.initializer != null) {
@@ -626,10 +623,9 @@ class AllInfoToJsonConverter extends Converter<AllInfo, Map>
626623
_visitBasicInfo(info)..['type'] = info.type;
627624

628625
@override
629-
Map visitOutput(OutputUnitInfo info) =>
630-
_visitBasicInfo(info)
631-
..['filename'] = info.filename
632-
..['imports'] = info.imports;
626+
Map visitOutput(OutputUnitInfo info) => _visitBasicInfo(info)
627+
..['filename'] = info.filename
628+
..['imports'] = info.imports;
633629

634630
Object _serializeCode(List<CodeSpan> code) {
635631
if (isBackwardCompatible) {

pkg/dart2js_info/lib/proto_info_codec.dart

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ class AllInfoToProtoConverter extends Converter<AllInfo, AllInfoPB> {
129129
}
130130

131131
FunctionInfoPB _convertToFunctionInfoPB(FunctionInfo info) {
132-
final proto =
133-
FunctionInfoPB()
134-
..functionModifiers = _convertToFunctionModifiers(info.modifiers)
135-
..inlinedCount = info.inlinedCount ?? 0;
132+
final proto = FunctionInfoPB()
133+
..functionModifiers = _convertToFunctionModifiers(info.modifiers)
134+
..inlinedCount = info.inlinedCount ?? 0;
136135

137136
proto.returnType = info.returnType;
138137

@@ -151,11 +150,10 @@ class AllInfoToProtoConverter extends Converter<AllInfo, AllInfoPB> {
151150
}
152151

153152
FieldInfoPB _convertToFieldInfoPB(FieldInfo info) {
154-
final proto =
155-
FieldInfoPB()
156-
..type = info.type
157-
..inferredType = info.inferredType
158-
..isConst = info.isConst;
153+
final proto = FieldInfoPB()
154+
..type = info.type
155+
..inferredType = info.inferredType
156+
..isConst = info.isConst;
159157

160158
proto.code = info.code.map((c) => c.text).join('\n');
161159

@@ -189,11 +187,10 @@ class AllInfoToProtoConverter extends Converter<AllInfo, AllInfoPB> {
189187
}
190188

191189
InfoPB _convertToInfoPB(Info info) {
192-
final proto =
193-
InfoPB()
194-
..id = idFor(info).id
195-
..serializedId = idFor(info).serializedId
196-
..size = info.size;
190+
final proto = InfoPB()
191+
..id = idFor(info).id
192+
..serializedId = idFor(info).serializedId
193+
..size = info.size;
197194

198195
proto.name = info.name;
199196

@@ -240,22 +237,19 @@ class AllInfoToProtoConverter extends Converter<AllInfo, AllInfoPB> {
240237
}
241238

242239
ProgramInfoPB _convertToProgramInfoPB(ProgramInfo info) {
243-
var result =
244-
ProgramInfoPB()
245-
..entrypointId = idFor(info.entrypoint).serializedId
246-
..size = info.size
247-
..compilationMoment = Int64(
248-
info.compilationMoment.microsecondsSinceEpoch,
249-
)
250-
..compilationDuration = Int64(info.compilationDuration.inMicroseconds)
251-
..toProtoDuration = Int64(info.toJsonDuration.inMicroseconds)
252-
..dumpInfoDuration = Int64(info.dumpInfoDuration.inMicroseconds)
253-
..noSuchMethodEnabled = info.noSuchMethodEnabled
254-
..isRuntimeTypeUsed = info.isRuntimeTypeUsed
255-
..isIsolateUsed = info.isIsolateInUse
256-
..isFunctionApplyUsed = info.isFunctionApplyUsed
257-
..isMirrorsUsed = info.isMirrorsUsed
258-
..minified = info.minified;
240+
var result = ProgramInfoPB()
241+
..entrypointId = idFor(info.entrypoint).serializedId
242+
..size = info.size
243+
..compilationMoment = Int64(info.compilationMoment.microsecondsSinceEpoch)
244+
..compilationDuration = Int64(info.compilationDuration.inMicroseconds)
245+
..toProtoDuration = Int64(info.toJsonDuration.inMicroseconds)
246+
..dumpInfoDuration = Int64(info.dumpInfoDuration.inMicroseconds)
247+
..noSuchMethodEnabled = info.noSuchMethodEnabled
248+
..isRuntimeTypeUsed = info.isRuntimeTypeUsed
249+
..isIsolateUsed = info.isIsolateInUse
250+
..isFunctionApplyUsed = info.isFunctionApplyUsed
251+
..isMirrorsUsed = info.isMirrorsUsed
252+
..minified = info.minified;
259253

260254
if (info.dart2jsVersion != null) {
261255
result.dart2jsVersion = info.dart2jsVersion!;
@@ -277,10 +271,9 @@ class AllInfoToProtoConverter extends Converter<AllInfo, AllInfoPB> {
277271
String libraryUri,
278272
Map<String, dynamic> fields,
279273
) {
280-
final proto =
281-
LibraryDeferredImportsPB()
282-
..libraryUri = libraryUri
283-
..libraryName = fields['name'] ?? '<unnamed>';
274+
final proto = LibraryDeferredImportsPB()
275+
..libraryUri = libraryUri
276+
..libraryName = fields['name'] ?? '<unnamed>';
284277

285278
Map<String, List<String>> imports = fields['imports'];
286279
imports.forEach((prefix, files) {

pkg/dart2js_info/lib/src/binary/sink.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ class BufferedSink {
331331
BufferedSink(this._sink);
332332

333333
void addDouble(double d) {
334-
final doubleBufferUint8 =
335-
_doubleBufferUint8 ??= _doubleBuffer.buffer.asUint8List();
334+
final doubleBufferUint8 = _doubleBufferUint8 ??= _doubleBuffer.buffer
335+
.asUint8List();
336336
_doubleBuffer[0] = d;
337337
addByte4(
338338
doubleBufferUint8[0],

pkg/dart2js_info/lib/src/binary/source.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ abstract class AbstractDataSource extends DataSourceMixin
176176

177177
@override
178178
E readCached<E>(E Function() f) {
179-
IndexedSource source =
180-
_generalCaches[E] ??= IndexedSource<E>(_readIntInternal);
179+
IndexedSource source = _generalCaches[E] ??= IndexedSource<E>(
180+
_readIntInternal,
181+
);
181182
return source.read(f);
182183
}
183184

pkg/dart2js_info/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: >-
66
--dump-info.
77
88
environment:
9-
sdk: '^3.7.0'
9+
sdk: '^3.8.0'
1010

1111
resolution: workspace
1212

pkg/dart2js_info/test/runtime_coverage_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ void main() {
3131
'classes/classes.js.info.data',
3232
);
3333
allInfo = decode(infoBinaryFile.readAsBytesSync());
34-
classFilters =
35-
(await resolveTestFile(
36-
'classes/class_filter.txt',
37-
)).readAsLinesSync();
34+
classFilters = (await resolveTestFile(
35+
'classes/class_filter.txt',
36+
)).readAsLinesSync();
3837
});
3938

4039
setUp(() {

0 commit comments

Comments
 (0)