(arrowFn: ts.ArrowFunction, context: any)
| 232 | throw new Error(`Unsupported expression node type: ${ts.SyntaxKind[node.kind]}`); |
| 233 | } |
| 234 | function createCallback(arrowFn: ts.ArrowFunction, context: any): Function { |
| 235 | if (arrowFn.parameters.length !== 1) { |
| 236 | throw new Error('Only arrow functions with exactly 1 parameter are supported'); |
| 237 | } |
| 238 | const paramName = (arrowFn.parameters[0].name as ts.Identifier).text; |
| 239 | |
| 240 | return (val: any) => { |
| 241 | const childContext = Object.create(context); |
| 242 | childContext[paramName] = val; |
| 243 | |
| 244 | return evaluateNode(arrowFn.body, childContext); |
| 245 | }; |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Transforms a condition expression from PullApprove that is based on python |
no test coverage detected