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

Function conditionalExpression

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

Source from the content-addressed store, hash-verified

219 }
220
221 function conditionalExpression(): ASTNodeOrNull {
222 const ast = logicalOrExpression();
223
224 if (!ast) {
225 return null;
226 }
227
228 if (matchPunctuator('?')) {
229 next();
230 let consequent = assignmentExpression();
231 assert(consequent);
232 assert(matchPunctuator(':'));
233
234 next();
235 let alternate = assignmentExpression();
236 assert(alternate);
237
238 return {
239 type: 'conditional',
240 test: ast,
241 consequent: consequent,
242 alternate: alternate,
243 start: ast.start,
244 end: alternate!.end
245 };
246 }
247
248 return ast;
249 }
250
251 function binaryExpressionParser(
252 type: string,

Callers 1

assignmentExpressionFunction · 0.85

Calls 5

logicalOrExpressionFunction · 0.85
matchPunctuatorFunction · 0.85
nextFunction · 0.85
assignmentExpressionFunction · 0.85
assertFunction · 0.85

Tested by

no test coverage detected