Skip to content

Commit 4b7fef5

Browse files
MarkzipanCommit Queue
authored andcommitted
[ddc] Clearing RTI environment eval caches on hot reload.
Fixes #60267 Change-Id: I0abd119311c69ce69a2ebdc99b94f3051f5d3984 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414188 Reviewed-by: Stephen Adams <[email protected]> Commit-Queue: Mark Zhou <[email protected]> Reviewed-by: Mayank Patke <[email protected]>
1 parent 48943ce commit 4b7fef5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sdk/lib/_internal/js_shared/lib/rti.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,20 @@ Rti _rtiBind(Rti environment, Rti types) {
576576
/// app (such as after a hot reload).
577577
void resetRtiSubtypeCaches() {
578578
var universe = _theUniverse();
579-
var cache = _Universe.evalCache(universe);
580-
var values = _Utils.mapValues(cache);
581-
var length = _Utils.arrayLength(values);
579+
var evalCache = _Universe.evalCache(universe);
580+
var cacheValues = _Utils.mapValues(evalCache);
581+
var length = _Utils.arrayLength(cacheValues);
582582
for (int i = 0; i < length; i++) {
583-
Rti rti = _Utils.asRti(_Utils.arrayAt(values, i));
583+
Rti rti = _Utils.asRti(_Utils.arrayAt(cacheValues, i));
584584
var sCache = Rti._getRawIsSubtypeCache(rti);
585585
if (sCache != null) {
586586
_Utils.mapClear(sCache);
587587
}
588+
// Clear eval caches on RTIs that are type environments.
589+
var rtiCache = Rti._getEvalCache(rti);
590+
if (rtiCache != null) {
591+
_Utils.mapClear(rtiCache);
592+
}
588593
}
589594
}
590595

0 commit comments

Comments
 (0)