]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: refactor export data parsing
authorMatthew Dempsky <mdempsky@google.com>
Tue, 1 Dec 2015 20:19:36 +0000 (12:19 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Sat, 20 Feb 2016 04:31:42 +0000 (04:31 +0000)
commit7d3a40978aaa69c3cf08068a83252927b4514e9d
tree189547963af789e46600fedff9507523e76c7f53
parent0d5e6a3f07414ecf6a14bc601532aa305296f562
cmd/compile: refactor export data parsing

Merge push_parser and pop_parser into a single parse_import function
and inline unimportfile. Shake out function boundaries a little bit so
that the symmetry is readily visible.

Move the import_package call into parse_import (and inline
import_there into import_package).  This means importfile no longer
needs to provide fake import data to be needlessly lexed/parsed every
time it's called.

Also, instead of indicating import success/failure by whether the next
token is "package", import_spec can just check whether importpkg is
non-nil.

Tangentially, this somehow alters the diagnostics produced for
test/fixedbugs/issue11610.go.  However, the new diagnostics are more
consistent with those produced when the empty import statement is
absent, which seems more desirable than maintaining the previous
errors.

Change-Id: I5cd1c22aa14da8a743ef569ff084711d137279d5
Reviewed-on: https://go-review.googlesource.com/19650
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/parser.go
test/fixedbugs/issue11610.go