@@ -92,20 +92,22 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
92
92
) { }
93
93
94
94
get ( target : Target , key : string | symbol , receiver : object ) {
95
+ const isReadonly = this . _isReadonly ,
96
+ shallow = this . _shallow
95
97
if ( key === ReactiveFlags . IS_REACTIVE ) {
96
- return ! this . _isReadonly
98
+ return ! isReadonly
97
99
} else if ( key === ReactiveFlags . IS_READONLY ) {
98
- return this . _isReadonly
100
+ return isReadonly
99
101
} else if ( key === ReactiveFlags . IS_SHALLOW ) {
100
- return this . _shallow
102
+ return shallow
101
103
} else if (
102
104
key === ReactiveFlags . RAW &&
103
105
receiver ===
104
- ( this . _isReadonly
105
- ? this . _shallow
106
+ ( isReadonly
107
+ ? shallow
106
108
? shallowReadonlyMap
107
109
: readonlyMap
108
- : this . _shallow
110
+ : shallow
109
111
? shallowReactiveMap
110
112
: reactiveMap
111
113
) . get ( target )
@@ -115,7 +117,7 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
115
117
116
118
const targetIsArray = isArray ( target )
117
119
118
- if ( ! this . _isReadonly ) {
120
+ if ( ! isReadonly ) {
119
121
if ( targetIsArray && hasOwn ( arrayInstrumentations , key ) ) {
120
122
return Reflect . get ( arrayInstrumentations , key , receiver )
121
123
}
@@ -130,11 +132,11 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
130
132
return res
131
133
}
132
134
133
- if ( ! this . _isReadonly ) {
135
+ if ( ! isReadonly ) {
134
136
track ( target , TrackOpTypes . GET , key )
135
137
}
136
138
137
- if ( this . _shallow ) {
139
+ if ( shallow ) {
138
140
return res
139
141
}
140
142
@@ -147,7 +149,7 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
147
149
// Convert returned value into a proxy as well. we do the isObject check
148
150
// here to avoid invalid value warning. Also need to lazy access readonly
149
151
// and reactive here to avoid circular dependency.
150
- return this . _isReadonly ? readonly ( res ) : reactive ( res )
152
+ return isReadonly ? readonly ( res ) : reactive ( res )
151
153
}
152
154
153
155
return res
0 commit comments