File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -522,6 +522,11 @@ function mustNotCall(msg) {
522522const _mustNotMutateProxies = new WeakMap ( ) ;
523523
524524function mustNotMutate ( object ) {
525+ const cachedProxy = _mustNotMutateProxies . get ( object ) ;
526+ if ( cachedProxy ) {
527+ return cachedProxy ;
528+ }
529+
525530 const _mustNotMutateHandler = {
526531 defineProperty ( target , property , descriptor ) {
527532 assert . fail ( `Expected no side effects, got ${ property } defined` ) ;
@@ -548,13 +553,9 @@ function mustNotMutate(object) {
548553 }
549554 } ;
550555
551- const cachedProxy = _mustNotMutateProxies . get ( object ) ;
552- if ( cachedProxy ) {
553- return cachedProxy ;
554- }
555- const newProxy = new Proxy ( object , _mustNotMutateHandler ) ;
556- _mustNotMutateProxies . set ( object , newProxy ) ;
557- return newProxy ;
556+ const proxy = new Proxy ( object , _mustNotMutateHandler ) ;
557+ _mustNotMutateProxies . set ( object , proxy ) ;
558+ return proxy ;
558559}
559560
560561function printSkipMessage ( msg ) {
You can’t perform that action at this time.
0 commit comments