()
| 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(); |
no test coverage detected