mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[dart2js:dump_info] put version and program info first...
...more consistent sorting of holdings (improves diffing) Change-Id: I2f2c418edea1f2dec6b8cc26e8058a5e3855ceb2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271820 Auto-Submit: Kevin Moore <kevmoo@google.com> Commit-Queue: Kevin Moore <kevmoo@google.com> Reviewed-by: Mark Zhou <markzipan@google.com>
This commit is contained in:
parent
fe087f24d1
commit
67015b7175
|
@ -415,17 +415,30 @@ class AllInfoToJsonConverter extends Converter<AllInfo, Map>
|
|||
};
|
||||
}
|
||||
|
||||
Map visitDependencyInfo(DependencyInfo info) =>
|
||||
{'id': idFor(info.target).serializedId, 'mask': info.mask};
|
||||
Map visitDependencyInfo(DependencyInfo info) => {
|
||||
'id': idFor(info.target).serializedId,
|
||||
if (info.mask != null) 'mask': info.mask,
|
||||
};
|
||||
|
||||
Map _visitAllInfoHolding(AllInfo allInfo) {
|
||||
var map = SplayTreeMap<String, List>(compareNatural);
|
||||
void helper(CodeInfo info) {
|
||||
if (info.uses.isEmpty) return;
|
||||
map[idFor(info).serializedId] = info.uses
|
||||
.map(visitDependencyInfo)
|
||||
.toList()
|
||||
..sort((a, b) => a['id'].compareTo(b['id']));
|
||||
map[idFor(info).serializedId] =
|
||||
info.uses.map(visitDependencyInfo).toList()
|
||||
..sort((a, b) {
|
||||
final value = a['id'].compareTo(b['id']);
|
||||
if (value != 0) return value;
|
||||
final aMask = a['mask'] as String?;
|
||||
final bMask = b['mask'] as String?;
|
||||
if (aMask == null) {
|
||||
return bMask == null ? 0 : 1;
|
||||
}
|
||||
if (bMask == null) {
|
||||
return -1;
|
||||
}
|
||||
return aMask.compareTo(bMask);
|
||||
});
|
||||
}
|
||||
|
||||
allInfo.functions.forEach(helper);
|
||||
|
@ -447,14 +460,14 @@ class AllInfoToJsonConverter extends Converter<AllInfo, Map>
|
|||
var jsonHolding = _visitAllInfoHolding(info);
|
||||
var jsonDependencies = _visitAllInfoDependencies(info);
|
||||
return {
|
||||
'dump_version': isBackwardCompatible ? 5 : info.version,
|
||||
'dump_minor_version': isBackwardCompatible ? 1 : info.minorVersion,
|
||||
'program': info.program!.accept(this),
|
||||
'elements': elements,
|
||||
'holding': jsonHolding,
|
||||
'dependencies': jsonDependencies,
|
||||
'outputUnits': info.outputUnits.map((u) => u.accept(this)).toList(),
|
||||
'dump_version': isBackwardCompatible ? 5 : info.version,
|
||||
'deferredFiles': info.deferredFiles,
|
||||
'dump_minor_version': isBackwardCompatible ? 1 : info.minorVersion,
|
||||
'program': info.program!.accept(this)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue