More steps towards tracking of identifier scopes.

- provide scope to parse functions; if non-nil, parser uses the scope
  to declare and lookup identifiers
- resolve forward references where possible

R=rsc
CC=golang-dev
https://golang.org/cl/194098
This commit is contained in:
Robert Griesemer 2010-01-27 09:44:28 -08:00
parent 1c369bd55f
commit f39dc9fff2
13 changed files with 103 additions and 70 deletions

View file

@ -37,7 +37,7 @@ func initRewrite() {
// but there are problems with preserving formatting and also
// with what a wildcard for a statement looks like.
func parseExpr(s string, what string) ast.Expr {
x, err := parser.ParseExpr("input", s)
x, err := parser.ParseExpr("input", s, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "parsing %s %s: %s\n", what, s, err)
os.Exit(2)