mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[dart2js] Fix dump-info tests by starting indexing at 0 instead of 1.
Also should cache on `serializedId` rather than just the `name`. Change-Id: I16e095fea5f320d39d55374ce354b9302c3a1e75 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346024 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>
This commit is contained in:
parent
d0e3d48172
commit
df5a3d8678
|
@ -375,8 +375,12 @@ class AllInfoToJsonConverter extends Converter<AllInfo, Map>
|
||||||
|
|
||||||
// longName isn't guaranteed to create unique serializedIds for some info
|
// longName isn't guaranteed to create unique serializedIds for some info
|
||||||
// constructs (such as closures), so we disambiguate here.
|
// constructs (such as closures), so we disambiguate here.
|
||||||
final count = idCounter.update(name, (v) => v + 1, ifAbsent: () => 0);
|
Id id = Id(info.kind, name);
|
||||||
final id = Id(info.kind, count == 0 ? name : '$name%$count');
|
final count =
|
||||||
|
idCounter.update(id.serializedId, (v) => v + 1, ifAbsent: () => 0);
|
||||||
|
if (count > 0) {
|
||||||
|
id = Id(info.kind, '$name%${count - 1}');
|
||||||
|
}
|
||||||
return ids[info] = id;
|
return ids[info] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue