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
'use strict';classMyClass{// property with no value - this may look odd, but it's valid syntaxprop};constacorn=require('acorn');constastravel=require('astravel');constcomments=[]consttree=acorn.parse(MyClass.toString(),{ecmaVersion: 2023,onComment: comments});astravel.attachComments(tree,comments);
With the current astravel, this will error out:
/home/mureinik/src/git/test-astravel/node_modules/astravel/dist/require/defaultTraveler.js:23
if (this[node.type]) {
^
TypeError: Cannot read properties of null (reading 'type')
at Object.go (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/defaultTraveler.js:23:19)
at Object.MethodDefinition (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/defaultTraveler.js:356:10)
at attachCommentsToNode (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/attachComments.js:70:25)
at Object.Block (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/attachComments.js:90:3)
at Object.go (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/defaultTraveler.js:24:22)
at Object.ClassDeclaration (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/defaultTraveler.js:305:10)
at attachCommentsToNode (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/attachComments.js:70:25)
at Object.Block (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/attachComments.js:90:3)
at Object.attachComments (/home/allon/src/git/test-astravel/node_modules/astravel/dist/require/attachComments.js:112:22)
at Object.<anonymous> (/home/allon/src/git/test-astravel/index.js:13:10)
The text was updated successfully, but these errors were encountered:
mureinik
added a commit
to mureinik/astravel
that referenced
this issue
Nov 10, 2023
The
defaultTraveler
implicitly assumes that a node always has a value.This is usually true, but no always.
Consider the following:
required dependencies from
package.json
:With the current astravel, this will error out:
The text was updated successfully, but these errors were encountered: