MCPcopy
hub / github.com/baidu/amis / arrowFunction

Function arrowFunction

packages/amis-formula/src/parser.ts:188–219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

186 }
187
188 function arrowFunction(): ASTNodeOrNull {
189 let ast: any = argList() || variable();
190 let args: Array<any> = [];
191 let start: Position;
192
193 if (ast?.type === 'variable') {
194 args = [ast];
195 start = ast.start;
196 } else if (ast?.type === 'arg-list') {
197 start = ast.start;
198 args = ast.body;
199 }
200
201 if (Array.isArray(args) && matchPunctuator('=')) {
202 next();
203 if (matchPunctuator('>')) {
204 next();
205 const body = assert(expression());
206 return {
207 type: 'anonymous_function',
208 args: args,
209 return: body,
210 start: start!,
211 end: body.end
212 };
213 } else {
214 back();
215 }
216 }
217
218 return ast;
219 }
220
221 function conditionalExpression(): ASTNodeOrNull {
222 const ast = logicalOrExpression();

Callers 1

leftHandSideExpressionFunction · 0.85

Calls 7

argListFunction · 0.85
variableFunction · 0.85
matchPunctuatorFunction · 0.85
nextFunction · 0.85
assertFunction · 0.85
backFunction · 0.85
expressionFunction · 0.70

Tested by

no test coverage detected