-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ng/stmt,ng/expr: introduce a Walk function #93
Comments
I wonder if we could jump straight to an 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. |
Introduce a syntax.Node interface, which can represent any node in the syntax tree. Introduce a src.Pos object that represents a source file position, and put src.Pos on all the syntax tree nodes. Move the stmt, expr, and tipe packages under syntax to make their purpose clear. Start wiring source positions through the parser. Much more to do. Updates #95 Updates #93
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.) |
This syntax tree walker interface and design are deeply inspired by the Go syntax tree Apply function in golang.org/x/tools/go/ast/astutil. It will one day be extended to allow editing syntax trees. For #93
to fix #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?
The text was updated successfully, but these errors were encountered: