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

Function functionparams

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

Source from the content-addressed store, hash-verified

4994 return id;
4995 }
4996 function functionparams(options) {
4997 var next;
4998 var params = [];
4999 var ident;
5000 var tokens = [];
5001 var t;
5002 var pastDefault = false;
5003 var pastRest = false;
5004 var loneArg = options && options.loneArg;
5005
5006 if (loneArg && loneArg.identifier === true) {
5007 addlabel(loneArg.value, { type: "unused", token: loneArg });
5008 return [loneArg];
5009 }
5010
5011 next = state.tokens.next;
5012
5013 if (!options || !options.parsedOpening) {
5014 advance("(");
5015 }
5016
5017 if (state.tokens.next.id === ")") {
5018 advance(")");
5019 return;
5020 }
5021
5022 for (;;) {
5023 if (_.contains(["{", "["], state.tokens.next.id)) {
5024 tokens = destructuringExpression();
5025 for (t in tokens) {
5026 t = tokens[t];
5027 if (t.id) {
5028 params.push(t.id);
5029 addlabel(t.id, { type: "unused", token: t.token });
5030 }
5031 }
5032 } else {
5033 if (checkPunctuators(state.tokens.next, ["..."])) pastRest = true;
5034 ident = identifier(true);
5035 if (ident) {
5036 params.push(ident);
5037 addlabel(ident, { type: "unused", token: state.tokens.curr });
5038 } else {
5039 while (!checkPunctuators(state.tokens.next, [",", ")"])) advance();
5040 }
5041 }
5042 if (pastDefault) {
5043 if (state.tokens.next.id !== "=") {
5044 error("E051", state.tokens.current);
5045 }
5046 }
5047 if (state.tokens.next.id === "=") {
5048 if (!state.option.inESNext()) {
5049 warning("W119", state.tokens.next, "default parameters");
5050 }
5051 advance("=");
5052 pastDefault = true;
5053 expression(10);

Callers 1

doFunctionFunction · 0.85

Calls 9

addlabelFunction · 0.85
advanceFunction · 0.85
destructuringExpressionFunction · 0.85
checkPunctuatorsFunction · 0.85
identifierFunction · 0.85
warningFunction · 0.85
expressionFunction · 0.85
commaFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected