MCPcopy
hub / github.com/prettier/prettier / call

Method call

src/common/ast-path.js:126–140  ·  view source on GitHub ↗
(callback, ...names)

Source from the content-addressed store, hash-verified

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

Callers 15

mainPrintFunction · 0.80
recurseFunction · 0.80
constructorMethod · 0.80
isWhitespaceOnlyMethod · 0.80
getDocErrorMessageFunction · 0.80
genericPrintFunction · 0.80
printInverseFunction · 0.80

Calls 2

atMethod · 0.80
callbackFunction · 0.50

Tested by

no test coverage detected