yberreby / rgo

[STALLED] A Go compiler, written in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rework AST to convert strings to expressions

MovingtoMars opened this issue · comments

commented

Right now, in the AST, some things are stored as strings when they should be access expressions of some kind.

I noticed this comment in ast.rs: https://github.com/yberreby/rgo/blob/master/src/ast/mod.rs#L243.

The problem is that it won't work to store the function name as a string. It needs to be an expression. 90% of function calls will use a simple ident expression. See https://github.com/golang/go/blob/master/src/go/ast/ast.go#L317.

The Rust struct you linked is a function declaration, not a function call, though.

Here's the relevant struct in the Go source: https://github.com/golang/go/blob/master/src/go/ast/ast.go#L923-L930

commented

Ah, misread. Sorry!