Open sbinet opened 6 years ago
I wonder if we could jump straight to an Apply
interface. Something like the fallthrough detection doesn't actually need to modify the AST, but Apply can be used without making any changes. (And it would be super-simple to build a Walk on top of it.)
https://go-review.googlesource.com/c/tools/+/77811/4/go/ast/astutil/rewrite.go
We will need a generic Node interface. Right now there's no position information to expose by it (this is a long-standing TODO I keep not getting to). I'll file a separate issue about that.
Apply sounds good to me.
I need this for #5, so I'm going to take a look at it. (Though I'm back at work for a week, so it may have to wait until next weekend.)
to fix neugram/ng#92 I think we'd need some kind of a visitor for
stmt.Stmt
,expr.Expr
, etc...the
go/ast
hasast.Walk
:what do you think?