@@ -92,20 +92,22 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
9292 ) { }
9393
9494 get ( target : Target , key : string | symbol , receiver : object ) {
95+ const isReadonly = this . _isReadonly ,
96+ shallow = this . _shallow
9597 if ( key === ReactiveFlags . IS_REACTIVE ) {
96- return ! this . _isReadonly
98+ return ! isReadonly
9799 } else if ( key === ReactiveFlags . IS_READONLY ) {
98- return this . _isReadonly
100+ return isReadonly
99101 } else if ( key === ReactiveFlags . IS_SHALLOW ) {
100- return this . _shallow
102+ return shallow
101103 } else if (
102104 key === ReactiveFlags . RAW &&
103105 receiver ===
104- ( this . _isReadonly
105- ? this . _shallow
106+ ( isReadonly
107+ ? shallow
106108 ? shallowReadonlyMap
107109 : readonlyMap
108- : this . _shallow
110+ : shallow
109111 ? shallowReactiveMap
110112 : reactiveMap
111113 ) . get ( target )
@@ -115,7 +117,7 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
115117
116118 const targetIsArray = isArray ( target )
117119
118- if ( ! this . _isReadonly ) {
120+ if ( ! isReadonly ) {
119121 if ( targetIsArray && hasOwn ( arrayInstrumentations , key ) ) {
120122 return Reflect . get ( arrayInstrumentations , key , receiver )
121123 }
@@ -130,11 +132,11 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
130132 return res
131133 }
132134
133- if ( ! this . _isReadonly ) {
135+ if ( ! isReadonly ) {
134136 track ( target , TrackOpTypes . GET , key )
135137 }
136138
137- if ( this . _shallow ) {
139+ if ( shallow ) {
138140 return res
139141 }
140142
@@ -147,7 +149,7 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
147149 // Convert returned value into a proxy as well. we do the isObject check
148150 // here to avoid invalid value warning. Also need to lazy access readonly
149151 // and reactive here to avoid circular dependency.
150- return this . _isReadonly ? readonly ( res ) : reactive ( res )
152+ return isReadonly ? readonly ( res ) : reactive ( res )
151153 }
152154
153155 return res
0 commit comments