Skip to content

Commit 5f59670

Browse files
Exterskybrettz9
authored andcommitted
Fix ancestorsOnly check
1 parent 65f6367 commit 5f59670

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/exportParser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const mapVariables = function (node, globals, opt) {
188188
const opts = opt || {};
189189
switch (node.type) {
190190
case 'Program': {
191-
if (opts.ancestorsOnly) {
191+
if (!opts.ancestorsOnly) {
192192
node.body.forEach((childNode) => {
193193
mapVariables(childNode, globals, opts);
194194
});
@@ -317,7 +317,7 @@ const parseRecursive = function (node, globalVars, opts) {
317317
}
318318
}
319319

320-
return mapVariables(node, globalVars);
320+
return mapVariables(node, globalVars, opts);
321321
};
322322

323323
const parse = function (ast, node, opt) {
@@ -342,7 +342,7 @@ const parse = function (ast, node, opt) {
342342
parseRecursive(node, globalVars, opts);
343343
} else {
344344
initVariables(ast, globalVars, opts);
345-
mapVariables(ast, globalVars, {ancestorsOnly: true});
345+
mapVariables(ast, globalVars, opts);
346346
}
347347

348348
return {

0 commit comments

Comments
 (0)