MCPcopy
hub / github.com/sveltejs/svelte / call

Function call

packages/svelte/src/compiler/utils/builders.js:117–142  ·  view source on GitHub ↗
(callee, ...args)

Source from the content-addressed store, hash-verified

115 * @returns {ESTree.CallExpression}
116 */
117export function call(callee, ...args) {
118 if (typeof callee === 'string') callee = id(callee);
119 args = args.slice();
120
121 // replacing missing arguments with `void(0)`, unless they're at the end in which case remove them
122 let i = args.length;
123 let popping = true;
124 while (i--) {
125 if (!args[i]) {
126 if (popping) {
127 args.pop();
128 } else {
129 args[i] = void0;
130 }
131 } else {
132 popping = false;
133 }
134 }
135
136 return {
137 type: 'CallExpression',
138 callee,
139 arguments: /** @type {Array<ESTree.Expression | ESTree.SpreadElement>} */ (args),
140 optional: false
141 };
142}
143
144/**
145 * @param {string | ESTree.Expression} callee

Callers 1

maybe_callFunction · 0.85

Calls 2

idFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected