(target, prop, receiver)
| 120 | return prop === "loc" || prop in target; |
| 121 | }, |
| 122 | get(target, prop, receiver) { |
| 123 | if (prop === "loc") { |
| 124 | const loc = locationResolver.getLocation(target.start, target.end); |
| 125 | return { |
| 126 | start: { |
| 127 | line: loc[0], |
| 128 | offset: loc[1] |
| 129 | }, |
| 130 | end: { |
| 131 | line: loc[2], |
| 132 | offset: loc[3] |
| 133 | } |
| 134 | }; |
| 135 | } |
| 136 | |
| 137 | const value = Reflect.get(target, prop, receiver); |
| 138 | |
| 139 | if (Array.isArray(value)) { |
| 140 | return value.map((node) => { |
| 141 | if ( |
| 142 | !node || |
| 143 | typeof node !== "object" || |
| 144 | Array.isArray(node) || |
| 145 | !node.type |
| 146 | ) { |
| 147 | return node; |
| 148 | } |
| 149 | |
| 150 | return createLazyProxy(node, locationResolver, cache); |
| 151 | }); |
| 152 | } else if ( |
| 153 | value && |
| 154 | typeof value === "object" && |
| 155 | /** @type {T} */ (value).type |
| 156 | ) { |
| 157 | return createLazyProxy( |
| 158 | /** @type {NodeWithRange<T>} */ |
| 159 | ( |
| 160 | /** @type {unknown} */ |
| 161 | (value) |
| 162 | ), |
| 163 | locationResolver, |
| 164 | cache |
| 165 | ); |
| 166 | } |
| 167 | |
| 168 | return value; |
| 169 | } |
| 170 | }) |
| 171 | ); |
| 172 |
no test coverage detected