(statement, scope)
| 346 | } |
| 347 | |
| 348 | function readVariableDeclaration(statement, scope) { |
| 349 | if (statement?.type !== "VariableDeclaration") return null; |
| 350 | const values = new Map(); |
| 351 | const lookupScope = new Map(scope); |
| 352 | |
| 353 | for (const decl of statement.declarations || []) { |
| 354 | if (!decl || decl.type !== "VariableDeclarator") continue; |
| 355 | if (decl.id?.type !== "Identifier") continue; |
| 356 | if (!decl.init) continue; |
| 357 | try { |
| 358 | const value = evaluateNode(decl.init, lookupScope); |
| 359 | values.set(decl.id.name, value); |
| 360 | lookupScope.set(decl.id.name, value); |
| 361 | } catch (_) { |
| 362 | // Ignore unsupported declarations |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | return values.size ? values : null; |
| 367 | } |
| 368 | |
| 369 | function readCommonJsExport(statement, scope) { |
| 370 | if (statement?.type !== "ExpressionStatement") return undefined; |
no test coverage detected