(target: Target, key: string | symbol, receiver: object)
| 53 | ) {} |
| 54 | |
| 55 | get(target: Target, key: string | symbol, receiver: object): any { |
| 56 | if (key === ReactiveFlags.SKIP) return target[ReactiveFlags.SKIP] |
| 57 | |
| 58 | const isReadonly = this._isReadonly, |
| 59 | isShallow = this._isShallow |
| 60 | if (key === ReactiveFlags.IS_REACTIVE) { |
| 61 | return !isReadonly |
| 62 | } else if (key === ReactiveFlags.IS_READONLY) { |
| 63 | return isReadonly |
| 64 | } else if (key === ReactiveFlags.IS_SHALLOW) { |
| 65 | return isShallow |
| 66 | } else if (key === ReactiveFlags.RAW) { |
| 67 | if ( |
| 68 | receiver === |
| 69 | (isReadonly |
| 70 | ? isShallow |
| 71 | ? shallowReadonlyMap |
| 72 | : readonlyMap |
| 73 | : isShallow |
| 74 | ? shallowReactiveMap |
| 75 | : reactiveMap |
| 76 | ).get(target) || |
| 77 | // receiver is not the reactive proxy, but has the same prototype |
| 78 | // this means the receiver is a user proxy of the reactive proxy |
| 79 | Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver) |
| 80 | ) { |
| 81 | return target |
| 82 | } |
| 83 | // early return undefined |
| 84 | return |
| 85 | } |
| 86 | |
| 87 | const targetIsArray = isArray(target) |
| 88 | |
| 89 | if (!isReadonly) { |
| 90 | let fn: Function | undefined |
| 91 | if (targetIsArray && (fn = arrayInstrumentations[key])) { |
| 92 | return fn |
| 93 | } |
| 94 | if (key === 'hasOwnProperty') { |
| 95 | return hasOwnProperty |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | const res = Reflect.get( |
| 100 | target, |
| 101 | key, |
| 102 | // if this is a proxy wrapping a ref, return methods using the raw ref |
| 103 | // as receiver so that we don't have to call `toRaw` on the ref in all |
| 104 | // its class methods |
| 105 | isRef(target) ? target : receiver, |
| 106 | ) |
| 107 | |
| 108 | if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { |
| 109 | return res |
| 110 | } |
| 111 | |
| 112 | if (!isReadonly) { |
no test coverage detected