Skip to content

Commit 543c6f0

Browse files
committed
Properly check for presence of node.attributes in walkers
Closes #1425
1 parent 54097dc commit 543c6f0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

acorn-walk/src/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,9 @@ base.ExportAllDeclaration = (node, st, c) => {
360360
if (node.exported)
361361
c(node.exported, st)
362362
c(node.source, st, "Expression")
363-
for (let attr of node.attributes)
364-
c(attr, st)
363+
if (node.attributes)
364+
for (let attr of node.attributes)
365+
c(attr, st)
365366
}
366367
base.ImportAttribute = (node, st, c) => {
367368
c(node.value, st, "Expression")
@@ -370,8 +371,9 @@ base.ImportDeclaration = (node, st, c) => {
370371
for (let spec of node.specifiers)
371372
c(spec, st)
372373
c(node.source, st, "Expression")
373-
for (let attr of node.attributes)
374-
c(attr, st)
374+
if (node.attributes)
375+
for (let attr of node.attributes)
376+
c(attr, st)
375377
}
376378
base.ImportExpression = (node, st, c) => {
377379
c(node.source, st, "Expression")

0 commit comments

Comments
 (0)