Open voiser opened 9 years ago
Hi,
In order to perform AST transformations, like filtering or transcompiling, the Visitor interface could be redefined like:
interface Visitor<T> { ... T visit(BlahBlahNode node); ... }
And the Node interface should offer something like:
interface Node { T accept(Visitor<T> v) }
That would let us do something like:
MyASTNode transformed = rootNode.visit(new Visitor<MyASTNode> {...})
Current visitors could be declared as:
class ... implements Visitor<Void>
I think this change would have a low impact in the code.
What do you think?
Hi,
In order to perform AST transformations, like filtering or transcompiling, the Visitor interface could be redefined like:
And the Node interface should offer something like:
That would let us do something like:
Current visitors could be declared as:
I think this change would have a low impact in the code.
What do you think?