From 4f920cb11e592a0c222a53826e0d795d83fbd896 Mon Sep 17 00:00:00 2001 From: OnlyWick Date: Sat, 17 Feb 2024 22:00:25 +0800 Subject: [PATCH] chore(reactivity): consistent variable naming --- packages/reactivity/src/baseHandlers.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/reactivity/src/baseHandlers.ts b/packages/reactivity/src/baseHandlers.ts index a1b3003a5e7..cef4b0e7f39 100644 --- a/packages/reactivity/src/baseHandlers.ts +++ b/packages/reactivity/src/baseHandlers.ts @@ -89,26 +89,26 @@ function hasOwnProperty(this: object, key: string) { class BaseReactiveHandler implements ProxyHandler { constructor( protected readonly _isReadonly = false, - protected readonly _shallow = false, + protected readonly _isShallow = false, ) {} get(target: Target, key: string | symbol, receiver: object) { const isReadonly = this._isReadonly, - shallow = this._shallow + isShallow = this._isShallow if (key === ReactiveFlags.IS_REACTIVE) { return !isReadonly } else if (key === ReactiveFlags.IS_READONLY) { return isReadonly } else if (key === ReactiveFlags.IS_SHALLOW) { - return shallow + return isShallow } else if (key === ReactiveFlags.RAW) { if ( receiver === (isReadonly - ? shallow + ? isShallow ? shallowReadonlyMap : readonlyMap - : shallow + : isShallow ? shallowReactiveMap : reactiveMap ).get(target) || @@ -143,7 +143,7 @@ class BaseReactiveHandler implements ProxyHandler { track(target, TrackOpTypes.GET, key) } - if (shallow) { + if (isShallow) { return res } @@ -175,7 +175,7 @@ class MutableReactiveHandler extends BaseReactiveHandler { receiver: object, ): boolean { let oldValue = (target as any)[key] - if (!this._shallow) { + if (!this._isShallow) { const isOldValueReadonly = isReadonly(oldValue) if (!isShallow(value) && !isReadonly(value)) { oldValue = toRaw(oldValue)