Add initial methods draft for js parser visitor#113
Conversation
| @@ -1,2 +1,3 @@ | |||
| export * from './markers'; | |||
| export * from './visitor'; | |||
| export * from './tree'; | |||
There was a problem hiding this comment.
I think we should instead require client code to separately import the tree module. I am still uncertain about this, but we can discuss this on our weekly sync. I also don't really like how the WebStorm IDE adds imports, which has probably also influenced how I feel about this.
There was a problem hiding this comment.
Usually index ts imports all required bits for external users. in JS world in is unconvinient to import from internal subdiricotires
| return new J.Unknown(randomId(), Space.EMPTY, Markers.EMPTY, new Source(randomId(), Space.EMPTY, Markers.EMPTY, node.getText())); | ||
| } | ||
|
|
||
| visitEndOfFileToken(node: ts.Node) { |
There was a problem hiding this comment.
Am I correct in assuming that this class is generated? If so, we should also add the generator to the Git repo somewhere, so that we can rerun it when necessary. To that end I propose a few changes:
- Create an interface in a separate file, so that we can actually regenerate it
- Onlt generate a visit method for
Nodesubtypes. Specifically, I would probably only generate a visit method for those Node subtypes which have a correspondingcreatemethod in theNodeFactoryinterface - Change the parameter type to use the corresponding interface type. E.g.
visitIdentifier(node: ts.Identifier) - I think it would probably also be good to make the Visitor interface generic and then have an additional parameter of that generic
Ttype, which we can pass around. - Possibly we should also have a generic type parameter for the return type, which in our case would probably be
Jthen. But unsure about that part.
There was a problem hiding this comment.
it is not. I manually imported all possible methods
There was a problem hiding this comment.
we can remove method that are not used after we start working on lst. all those methods are created based on all possible kinds of nodes (see ts.SyntaxKind for more info)
No description provided.