(text)
| 334 | } |
| 335 | |
| 336 | function parseSafeExpression(text) { |
| 337 | const wrapped = `(${text})`; |
| 338 | const ast = parse(wrapped, { |
| 339 | ecmaVersion: "latest", |
| 340 | sourceType: "module", |
| 341 | allowHashBang: true, |
| 342 | }); |
| 343 | const statement = ast.body[0]; |
| 344 | if (statement?.type !== "ExpressionStatement") return null; |
| 345 | return evaluateNode(statement.expression, new Map()); |
| 346 | } |
| 347 | |
| 348 | function readVariableDeclaration(statement, scope) { |
| 349 | if (statement?.type !== "VariableDeclaration") return null; |
no test coverage detected