Commit 1b2c3e66 authored by Robert Griesemer's avatar Robert Griesemer

go/parser: resolve identifiers properly

Correctly distinguish between lhs and rhs identifiers
and resolve/declare them accordingly.

Collect field and method names in respective scopes
(will be available after some minor AST API changes).

Also collect imports since it's useful to have that
list directly w/o having to re-traverse the AST
(will also be available after some minor AST API changes).

No external API changes in this CL.

R=rsc, rog
CC=golang-dev
https://golang.org/cl/4271061
parent 0ac151fd
......@@ -69,7 +69,7 @@ func ParseExpr(fset *token.FileSet, filename string, src interface{}) (ast.Expr,
var p parser
p.init(fset, filename, data, 0)
x := p.parseExpr()
x := p.parseRhs()
if p.tok == token.SEMICOLON {
p.next() // consume automatically inserted semicolon, if any
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment