| 303 | } |
| 304 | }, |
| 305 | VariableDeclarator(path) { |
| 306 | const id = path.node.id; |
| 307 | if (t.isIdentifier(id)) { |
| 308 | declared.add(id.name); |
| 309 | } else if (t.isObjectPattern(id)) { |
| 310 | for (const prop of id.properties) { |
| 311 | if (t.isObjectProperty(prop)) { |
| 312 | const val: any = prop.value as any; |
| 313 | if (t.isIdentifier(val)) declared.add(val.name); |
| 314 | else if (t.isAssignmentPattern(val) && t.isIdentifier(val.left)) declared.add(val.left.name); |
| 315 | } else if (t.isRestElement(prop)) { |
| 316 | const arg: any = prop.argument as any; |
| 317 | if (t.isIdentifier(arg)) declared.add(arg.name); |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | }, |
| 322 | FunctionDeclaration(path) { |
| 323 | if (path.node.id?.name) declared.add(path.node.id.name); |
| 324 | }, |