mirror of
https://github.com/golang/go
synced 2024-11-19 02:24:41 -07:00
go/types: provide full source file extent to file scope
Change-Id: Ib3472ab9e6b5bae0b03474ea57857fde1afbd43a Reviewed-on: https://go-review.googlesource.com/10995 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
44761a8f84
commit
ee0cf325b1
@ -144,6 +144,10 @@ func TestEvalPos(t *testing.T) {
|
|||||||
type FT /* FT => , p.FT */ interface{}
|
type FT /* FT => , p.FT */ interface{}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
`
|
||||||
|
package p
|
||||||
|
/* T => , p.T */
|
||||||
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
fset := token.NewFileSet()
|
fset := token.NewFileSet()
|
||||||
|
@ -153,7 +153,10 @@ func (check *Checker) collectObjects() {
|
|||||||
// but there is no corresponding package object.
|
// but there is no corresponding package object.
|
||||||
check.recordDef(file.Name, nil)
|
check.recordDef(file.Name, nil)
|
||||||
|
|
||||||
fileScope := NewScope(check.pkg.scope, file.Pos(), file.End(), check.filename(fileNo))
|
// Use the actual source file extent rather than *ast.File extent since the
|
||||||
|
// latter doesn't include comments which appear at the end of the file.
|
||||||
|
f := check.fset.File(file.Pos())
|
||||||
|
fileScope := NewScope(check.pkg.scope, token.Pos(f.Base()), token.Pos(f.Base()+f.Size()), check.filename(fileNo))
|
||||||
check.recordScope(file, fileScope)
|
check.recordScope(file, fileScope)
|
||||||
|
|
||||||
for _, decl := range file.Decls {
|
for _, decl := range file.Decls {
|
||||||
|
Loading…
Reference in New Issue
Block a user