]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: improve declaration position precision
authorMatthew Dempsky <mdempsky@google.com>
Tue, 3 Apr 2018 00:33:38 +0000 (17:33 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 3 Apr 2018 05:45:44 +0000 (05:45 +0000)
commit26e0e8a840249d13f94596ebb519154505bd15f4
tree1f69199425d0ac02d3d945f4b90a5a530f84edd7
parentc65a2781be7a8029435ea3d6a3c54c601ac4ba3e
cmd/compile: improve declaration position precision

Previously, n.Pos was reassigned to lineno when declare was called,
which might not match where the identifier actually appeared in the
source. This caused a loss of position precision for function
parameters (which were all declared at the last parameter's position),
and required some clumsy workarounds in bimport.go.

This CL changes declare to leave n.Pos alone and also fixes a few
places where n.Pos was not being set correctly.

Change-Id: Ibe5b5fd30609c684367207df701f9a1bfa82867f
Reviewed-on: https://go-review.googlesource.com/104275
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/bimport.go
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/export.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/subr.go