(this: MapTypes, key: unknown)
| 99 | ): Instrumentations { |
| 100 | const instrumentations: Instrumentations = { |
| 101 | get(this: MapTypes, key: unknown) { |
| 102 | // #1772: readonly(reactive(Map)) should return readonly + reactive version |
| 103 | // of the value |
| 104 | const target = this[ReactiveFlags.RAW] |
| 105 | const rawTarget = toRaw(target) |
| 106 | const rawKey = toRaw(key) |
| 107 | if (!readonly) { |
| 108 | if (hasChanged(key, rawKey)) { |
| 109 | track(rawTarget, TrackOpTypes.GET, key) |
| 110 | } |
| 111 | track(rawTarget, TrackOpTypes.GET, rawKey) |
| 112 | } |
| 113 | const { has } = getProto(rawTarget) |
| 114 | const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive |
| 115 | if (has.call(rawTarget, key)) { |
| 116 | return wrap(target.get(key)) |
| 117 | } else if (has.call(rawTarget, rawKey)) { |
| 118 | return wrap(target.get(rawKey)) |
| 119 | } else if (target !== rawTarget) { |
| 120 | // #3602 readonly(reactive(Map)) |
| 121 | // ensure that the nested reactive `Map` can do tracking for itself |
| 122 | target.get(key) |
| 123 | } |
| 124 | }, |
| 125 | get size() { |
| 126 | const target = (this as unknown as IterableCollections)[ReactiveFlags.RAW] |
| 127 | !readonly && track(toRaw(target), TrackOpTypes.ITERATE, ITERATE_KEY) |
nothing calls this directly
no test coverage detected