(callback, ...names)
| 124 | // be restored to its original state after the callback is finished, so it |
| 125 | // is probably a mistake to retain a reference to the path. |
| 126 | call(callback, ...names) { |
| 127 | const { stack } = this; |
| 128 | const { length } = stack; |
| 129 | let value = stack.at(-1); |
| 130 | |
| 131 | for (const name of names) { |
| 132 | value = value?.[name]; |
| 133 | stack.push(name, value); |
| 134 | } |
| 135 | try { |
| 136 | return callback(this); |
| 137 | } finally { |
| 138 | stack.length = length; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * @template {(path: AstPath) => any} T |
no test coverage detected