]> Cypherpunks repositories - gostls13.git/commit
go/scanner: report errors for incorrect line directives
authorRobert Griesemer <gri@golang.org>
Tue, 13 Mar 2018 00:00:55 +0000 (17:00 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 15 Mar 2018 18:01:05 +0000 (18:01 +0000)
commit546bab8c295895368ce8ec3d97ff65472c1032ab
tree214975029523402b00e3f7cbba659e329c1c8dcc
parent9d4215311ba573a5b676de85b053eec03e577478
go/scanner: report errors for incorrect line directives

Based on decision for #24183. This makes the go/scanner behavior
match cmd/compile behavior. Adjusted a go/printer test that assumed
silent behavior for invalid line directive, and added more scanner
tests verifying the correct error position and message for invalid
line directives.

The filenames in line directives now remain untouched by the scanner;
there is no cleanup or conversion of relative into absolute paths
anymore, in sync with what the compiler's scanner/parser are doing.
Any kind of filename transformation has to be done by a client. This
makes the scanner code simpler and also more predictable.

For #24183.

Change-Id: Ia091548e1d3d89dfdf6e7d82dab50bea05742ce3
Reviewed-on: https://go-review.googlesource.com/100235
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/go/printer/testdata/comments.golden
src/go/printer/testdata/comments.input
src/go/scanner/scanner.go
src/go/scanner/scanner_test.go