]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/syntax: compute BranchStmt.Target statements
authorRobert Griesemer <gri@golang.org>
Wed, 19 Apr 2017 03:44:54 +0000 (20:44 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 21 Apr 2017 22:30:55 +0000 (22:30 +0000)
commita50962131acb7def8241cd5e78b99746c6e52771
tree0f4e9cb584519ed4c2a0526613b0201051e5187c
parent7b0b52ef2b2b86eef3b73859ceaa986c8c0e47f7
cmd/compile/internal/syntax: compute BranchStmt.Target statements

- Add new BranchStmt.Target field: It's the destination for break,
  continue, or goto statements.

- When parsing with CheckBranches enabled, set the BranchStmt.Target
  field. We get the information practically for free from the branch
  checker, so keep it for further use.

- Fix a couple of comments.

- This could use a test, but the new Target field is currently not
  used, and writing a test is tedious w/o a general tree visitor.
  Do it later. For now, visually verified output from syntax dump.

Change-Id: Id691d89efab514ad885e19ac9759506106579520
Reviewed-on: https://go-review.googlesource.com/40988
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/syntax/branches.go
src/cmd/compile/internal/syntax/dumper_test.go
src/cmd/compile/internal/syntax/nodes.go