MCPcopy
hub / github.com/prettier/prettier / callParent

Method callParent

src/common/ast-path.js:148–156  ·  view source on GitHub ↗

* @template {(path: AstPath) => any} T * @param {T} callback * @param {number} [count=0] * @returns {ReturnType }

(callback, count = 0)

Source from the content-addressed store, hash-verified

146 * @returns {ReturnType<T>}
147 */
148 callParent(callback, count = 0) {
149 const stackIndex = this.#getNodeStackIndex(count + 1);
150 const parentValues = this.stack.splice(stackIndex + 1);
151 try {
152 return callback(this);
153 } finally {
154 this.stack.push(...parentValues);
155 }
156 }
157
158 // Similar to AstPath.prototype.call, except that the value obtained by
159 // accessing this.getValue()[name1][name2]... should be array. The

Callers 7

printTrailingCommaFunction · 0.80
printWordFunction · 0.80
printMdastFunction · 0.80
isFollowedByRightBracketFunction · 0.80
ast-path.jsFile · 0.80

Calls 2

#getNodeStackIndexMethod · 0.95
callbackFunction · 0.50

Tested by

no test coverage detected