| 1825 | |
| 1826 | // a function's read the units' own body runs, once, as no function, class or loop holds it |
| 1827 | const isRunOnce = (id: Node): boolean => { |
| 1828 | for (let node = id.parent; node; node = node.parent) { |
| 1829 | switch (node.type) { |
| 1830 | case "ArrowFunctionExpression": |
| 1831 | case "FunctionExpression": |
| 1832 | case "FunctionDeclaration": |
| 1833 | case "ClassBody": |
| 1834 | case "ForStatement": |
| 1835 | case "ForInStatement": |
| 1836 | case "ForOfStatement": |
| 1837 | case "WhileStatement": |
| 1838 | case "DoWhileStatement": |
| 1839 | return false |
| 1840 | } |
| 1841 | } |
| 1842 | return true |
| 1843 | } |
| 1844 | |
| 1845 | // a value's read run once, and whenever its statement is, as an element, an argument or a property's value |
| 1846 | const isRunSurely = (id: Node): boolean => { |