periscopic
Advanced tools
Comparing version 4.0.1 to 4.0.2
{ | ||
"name": "periscopic", | ||
"description": "periscopic", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"repository": "Rich-Harris/periscopic", | ||
@@ -6,0 +6,0 @@ "main": "src/index.js", |
@@ -41,3 +41,3 @@ import { walk } from 'zimmerframe'; | ||
case 'ImportSpecifier': | ||
current_scope.declarations.set(node.local.name, specifier); | ||
current_scope.declarations.set(node.local.name, node); | ||
return; | ||
@@ -47,7 +47,8 @@ case 'ExportNamedDeclaration': | ||
map.set(node, (current_scope = new Scope(current_scope, true))); | ||
node.specifiers.forEach((specifier) => { | ||
for (const specifier of node.specifiers) { | ||
current_scope.declarations.set(specifier.local.name, specifier); | ||
}); | ||
} | ||
return; | ||
} | ||
break; | ||
@@ -71,7 +72,7 @@ case 'FunctionExpression': | ||
node.params.forEach((param) => { | ||
extract_names(param).forEach((name) => { | ||
for (const param of node.params) { | ||
for (const name of extract_names(param)) { | ||
current_scope.declarations.set(name, node); | ||
}); | ||
}); | ||
} | ||
} | ||
break; | ||
@@ -96,7 +97,7 @@ | ||
if (node.param) { | ||
extract_names(node.param).forEach((name) => { | ||
for (const name of extract_names(node.param)) { | ||
if (node.param) { | ||
current_scope.declarations.set(name, node.param); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -167,11 +168,8 @@ break; | ||
} else { | ||
/** @param {import('estree').VariableDeclarator} declarator */ | ||
const handle_declarator = (declarator) => { | ||
extract_names(declarator.id).forEach((name) => { | ||
for (const declarator of node.declarations) { | ||
for (const name of extract_names(declarator.id)) { | ||
this.declarations.set(name, node); | ||
if (declarator.init) this.initialised_declarations.add(name); | ||
}); | ||
}; | ||
node.declarations.forEach(handle_declarator); | ||
} | ||
} | ||
} | ||
@@ -231,4 +229,3 @@ } else if (node.id) { | ||
case 'ObjectPattern': | ||
/** @param {import('estree').Property | import('estree').RestElement} prop */ | ||
const handle_prop = (prop) => { | ||
for (const prop of param.properties) { | ||
if (prop.type === 'RestElement') { | ||
@@ -239,18 +236,11 @@ extract_identifiers(prop.argument, nodes); | ||
} | ||
}; | ||
} | ||
param.properties.forEach(handle_prop); | ||
break; | ||
case 'ArrayPattern': | ||
/** @param {import('estree').Node} element */ | ||
const handle_element = (element) => { | ||
for (const element of param.elements) { | ||
if (element) extract_identifiers(element, nodes); | ||
}; | ||
} | ||
param.elements.forEach((element) => { | ||
if (element) { | ||
handle_element(element); | ||
} | ||
}); | ||
break; | ||
@@ -257,0 +247,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10735
230