You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constcomments=[]constsource=["Promise.all([import('foo')])",'// Some comment'].join('\n')constast=acorn.parse(source,{onComment: comments,sourceType: 'module',locations: true,ecmaVersion: 2023})astravel.attachComments(ast,comments)
You can see a demo on the astring demo site (be sure to check the Include comments checkbox). It produces the following stack trace:
TypeError: traveler2[child.type] is not a function
TypeError: traveler2[child.type] is not a function
at attachCommentsToNode (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:456:26)
at Object.ArrayExpression (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:481:5)
at Object.go (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:12:22)
at Object.CallExpression (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:271:12)
at Object.go (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:12:22)
at Object.ExpressionStatement (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:58:10)
at attachCommentsToNode (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:456:26)
at Object.Block$1 (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:471:3)
at Module.attachComments (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/astravel.js:491:22)
at HTMLTextAreaElement.update (https://david.bonnet.cc/astring/demo/:78:22)
Seems to be specific to a Promise.all expression that includes an ImportExpression, e.g., Promise.all([import('foo')]). Any comment type following that will produce the error.
EDIT: The error can be triggered with this simplified source
Example code to reproduce the issue:
You can see a demo on the
astring
demo site (be sure to check the Include comments checkbox). It produces the following stack trace:Seems to be specific to a
Promise.all
expression that includes anImportExpression
, e.g.,Promise.all([import('foo')])
. Any comment type following that will produce the error.EDIT: The error can be triggered with this simplified source
Potentially related to davidbonnet/astring#562.
The text was updated successfully, but these errors were encountered: