mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
- 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>
22 lines
416 B
Go
22 lines
416 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package syntax
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestDump(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping test in short mode")
|
|
}
|
|
|
|
ast, err := ParseFile(*src_, nil, nil, CheckBranches)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
Fdump(os.Stdout, ast)
|
|
}
|