(statement: Node, read: Node, code: string)
| 1878 | |
| 1879 | // whether a statement calls something impure before it reads a value there |
| 1880 | const callsBefore = (statement: Node, read: Node, code: string): boolean => { |
| 1881 | let calls = false |
| 1882 | walk(statement, node => { |
| 1883 | if ( |
| 1884 | (node.type === "CallExpression" || node.type === "NewExpression") && |
| 1885 | node.end <= read.start && |
| 1886 | !isPureExpression(node, code) |
| 1887 | ) |
| 1888 | calls = true |
| 1889 | return !isFunctionExpression(node) |
| 1890 | }) |
| 1891 | return calls |
| 1892 | } |
| 1893 | |
| 1894 | // the last statement's span takes in the `;` and return the pass appends |
| 1895 | const statementEndIn = (body: string, statement: Node): number => |
no test coverage detected