aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2012-11-19 13:23:32 -0800
committerRobert Griesemer <gri@golang.org>2012-11-19 13:23:32 -0800
commitc00bda13528c47b604595b17d76cf4b89425f632 (patch)
tree32ce2a019163fef11872b14f2da69dc7f89dd386 /src
parent09f3c2f10f3336375975620c8ea47e03f2850c92 (diff)
downloadgo-c00bda13528c47b604595b17d76cf4b89425f632.tar.xz
go/printer: simply ignore filename changes in position information
There's no good reason to make any printer state adjustments simply because the file name in node position information has changed. Eliminate the relevant code. R=r CC=golang-dev https://golang.org/cl/6856054
Diffstat (limited to 'src')
-rw-r--r--src/pkg/go/printer/printer.go15
1 files changed, 0 insertions, 15 deletions
diff --git a/src/pkg/go/printer/printer.go b/src/pkg/go/printer/printer.go
index fa591c5764..e79e3ffda2 100644
--- a/src/pkg/go/printer/printer.go
+++ b/src/pkg/go/printer/printer.go
@@ -221,21 +221,6 @@ func (p *printer) writeString(pos token.Position, s string, isLit bool) {
// atLineBegin updates p.pos if there's indentation, but p.pos
// is the position of s.
p.pos = pos
- // reset state if the file changed
- // (used when printing merged ASTs of different files
- // e.g., the result of ast.MergePackageFiles)
- if p.last.IsValid() && p.last.Filename != pos.Filename {
- // Note: Do not set p.indent to 0 - this seems to be a bad heuristic.
- // ASTs may be created by various tools and built from nodes of
- // different files. An incorrectly constructed AST will likely
- // not print at all, but a (structurally) correct AST with bad
- // position information should still print structurally correct.
- // If p.indent is reset, indentation may be off, and likely lead
- // to indentation underflow (to detect set: debug = true).
- // See also issue 4300 (11/16/2012).
- p.mode = 0
- p.wsbuf = p.wsbuf[0:0]
- }
}
if isLit {