MCPcopy
hub / github.com/PaulTaykalo/objc-dependency-visualizer / doFunction

Function doFunction

Scripts/ace/worker-javascript.js:5157–5232  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

5155 }
5156 }
5157 function doFunction(options) {
5158 var f, name, statement, classExprBinding, isGenerator, isArrow;
5159 var oldOption = state.option;
5160 var oldIgnored = state.ignored;
5161 var oldScope = scope;
5162
5163 if (options) {
5164 name = options.name;
5165 statement = options.statement;
5166 classExprBinding = options.classExprBinding;
5167 isGenerator = options.type === "generator";
5168 isArrow = options.type === "arrow";
5169 }
5170
5171 state.option = Object.create(state.option);
5172 state.ignored = Object.create(state.ignored);
5173 scope = Object.create(scope);
5174
5175 funct = functor(name || state.nameStack.infer(), state.tokens.next, scope, {
5176 "(statement)": statement,
5177 "(context)": funct,
5178 "(generator)": isGenerator
5179 });
5180
5181 f = funct;
5182 state.tokens.curr.funct = funct;
5183
5184 functions.push(funct);
5185
5186 if (name) {
5187 addlabel(name, { type: "function" });
5188 }
5189
5190 if (classExprBinding) {
5191 addlabel(classExprBinding, { type: "function" });
5192 }
5193
5194 funct["(params)"] = functionparams(options);
5195 funct["(metrics)"].verifyMaxParametersPerFunction(funct["(params)"]);
5196
5197 if (isArrow) {
5198 if (!state.option.esnext) {
5199 warning("W119", state.tokens.curr, "arrow function syntax (=>)");
5200 }
5201
5202 if (!options.loneArg) {
5203 advance("=>");
5204 }
5205 }
5206
5207 block(false, true, true, isArrow);
5208
5209 if (!state.option.noyield && isGenerator &&
5210 funct["(generator)"] !== "yielded") {
5211 warning("W124", state.tokens.curr);
5212 }
5213
5214 funct["(metrics)"].verifyMaxStatementsPerFunction();

Callers 3

applicationFunction · 0.85
classbodyFunction · 0.85

Calls 6

functorFunction · 0.85
addlabelFunction · 0.85
functionparamsFunction · 0.85
warningFunction · 0.85
advanceFunction · 0.85
blockFunction · 0.85

Tested by

no test coverage detected