]> Cypherpunks repositories - gostls13.git/commit
go/printer: leave indentation alone when printing nodes from different files
authorRobert Griesemer <gri@golang.org>
Fri, 16 Nov 2012 21:17:12 +0000 (13:17 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 16 Nov 2012 21:17:12 +0000 (13:17 -0800)
commitde58eb9091d24abd9d837b8a787ba90eadd1ab0a
tree70bf70dfad664d322700f3fee4715e4b9daeb68f
parenta42e8a80864281807384a6e5a45bebf3327a53fe
go/printer: leave indentation alone when printing nodes from different files

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.

One heuristic used was to reset indentation when the filename
in the position information of nodes changed. However, this
can lead to wrong indentation for structurally correct ASTs.

Fix: Don't change the indentation in this case.

Related to issue 4300.

R=r
CC=golang-dev
https://golang.org/cl/6849066
src/pkg/go/printer/printer.go