(node: ts.FunctionDeclaration)
| 442 | } |
| 443 | |
| 444 | parseFunctionDeclaration(node: ts.FunctionDeclaration): syntax.FunctionDeclaration { |
| 445 | if (!node.name) |
| 446 | throw new UnimplementedError(node, 'Empty function name is not supported'); |
| 447 | if (node.asteriskToken) |
| 448 | throw new UnimplementedError(node, 'Generator is not supported'); |
| 449 | if (node.questionToken) |
| 450 | throw new UnimplementedError(node, 'Question token in function is not supported'); |
| 451 | if (node.exclamationToken) |
| 452 | throw new UnimplementedError(node, 'Exclamation token in function is not supported'); |
| 453 | if (node.modifiers?.find(m => m.kind == ts.SyntaxKind.AsyncKeyword)) |
| 454 | throw new UnimplementedError(node, 'Async function is not supported'); |
| 455 | if (!ts.isSourceFile(node.parent)) |
| 456 | throw new UnimplementedError(node, 'Local function declaration is not supported'); |
| 457 | const {body, name, parameters} = node; |
| 458 | this.typer.forbidClosure(node); |
| 459 | return new syntax.FunctionDeclaration(this.typer.parseNodeType(node) as syntax.FunctionType, |
| 460 | isExportedDeclaration(node), |
| 461 | name.text, |
| 462 | this.parseParameters(parameters), |
| 463 | body ? this.parseStatement(body) as syntax.Block : undefined); |
| 464 | } |
| 465 | |
| 466 | parseFunctionExpression(node: ts.FunctionExpression | ts.ArrowFunction): syntax.FunctionExpression { |
| 467 | const {body, parameters, modifiers, asteriskToken, exclamationToken, questionToken, typeParameters} = node; |
no test coverage detected