@@ -522,32 +522,33 @@ function mustNotCall(msg) {
522522const _mustNotMutateProxies = new WeakMap ( ) ;
523523
524524function mustNotMutate ( object ) {
525+ if ( object === null || typeof object !== 'object' )
526+ return object ;
527+
525528 const cachedProxy = _mustNotMutateProxies . get ( object ) ;
526529 if ( cachedProxy ) {
527530 return cachedProxy ;
528531 }
529532
530533 const _mustNotMutateHandler = {
531534 defineProperty ( target , property , descriptor ) {
532- assert . fail ( `Expected no side effects, got ${ property } defined` ) ;
535+ assert . fail ( `Expected no side effects, got ${ util . inspect ( property ) } ` +
536+ 'defined' ) ;
533537 } ,
534538 deleteProperty ( target , property ) {
535- assert . fail ( `Expected no side effects, got ${ property } deleted` ) ;
539+ assert . fail ( `Expected no side effects, got ${ util . inspect ( property ) } ` +
540+ 'deleted' ) ;
536541 } ,
537542 get ( target , prop , receiver ) {
538- const value = Reflect . get ( target , prop , receiver ) ;
539- if ( value === null || typeof value !== 'object' ) {
540- return value ;
541- }
542- return mustNotMutate ( value ) ;
543+ return mustNotMutate ( Reflect . get ( target , prop , receiver ) ) ;
543544 } ,
544545 preventExtensions ( target ) {
545546 assert . fail ( 'Expected no side effects, got extensions prevented on ' +
546547 util . inspect ( target ) ) ;
547548 } ,
548549 set ( target , property , value , receiver ) {
549550 assert . fail ( `Expected no side effects, got ${ util . inspect ( value ) } ` +
550- `assigned to ${ property } ` ) ;
551+ `assigned to ${ util . inspect ( property ) } ` ) ;
551552 } ,
552553 setPrototypeOf ( target , prototype ) {
553554 assert . fail ( `Expected no side effects, got set prototype to ${ prototype } ` ) ;
0 commit comments