prefix?: string
start: number
end: number
+ scopeIds?: Set<string>
}
// Important: since this function uses Node.js only dependencies, it should
)
) {
const { name } = child
- if (
- (node as any)._scopeIds &&
- (node as any)._scopeIds.has(name)
- ) {
+ if (node.scopeIds && node.scopeIds.has(name)) {
return
}
if (name in knownIds) {
} else {
knownIds[name] = 1
}
- ;(
- (node as any)._scopeIds ||
- ((node as any)._scopeIds = new Set())
- ).add(name)
+ ;(node.scopeIds || (node.scopeIds = new Set())).add(name)
}
}
})
)
}
},
- leave(node: any) {
- if (node !== ast.body[0].expression && node._scopeIds) {
- node._scopeIds.forEach((id: string) => {
+ leave(node: Node & PrefixMeta) {
+ if (node !== ast.body[0].expression && node.scopeIds) {
+ node.scopeIds.forEach((id: string) => {
knownIds[id]--
if (knownIds[id] === 0) {
delete knownIds[id]