Commit 56bfe95e authored by Robert Griesemer's avatar Robert Griesemer

go/ast: change embedded token.Position fields to named fields

This is in preparation for a different position representation.
It also resolves situations where a node would be printed as
it's node position simply because the embedded token.Position
has a String method.

R=r
CC=golang-dev
https://golang.org/cl/2991041
parent 5928e1d4
......@@ -174,7 +174,7 @@ func (f *File) saveExport(x interface{}, context string) {
name := strings.TrimSpace(string(c.Text[9:]))
if name == "" {
error(c.Position, "export missing name")
error(c.Pos(), "export missing name")
}
f.ExpFunc = append(f.ExpFunc, &ExpFunc{
......
......@@ -80,7 +80,7 @@ func genSnippet(d *ast.GenDecl, id *ast.Ident) *Snippet {
}
// only use the spec containing the id for the snippet
dd := &ast.GenDecl{d.Doc, d.Position, d.Tok, d.Lparen, []ast.Spec{s}, d.Rparen}
dd := &ast.GenDecl{d.Doc, d.Pos(), d.Tok, d.Lparen, []ast.Spec{s}, d.Rparen}
return newSnippet(dd, id)
}
......
This diff is collapsed.
......@@ -51,7 +51,7 @@ func CheckPackage(pkg *ast.Package, importer Importer) os.Error {
//
func CheckFile(file *ast.File, importer Importer) os.Error {
// create a single-file dummy package
pkg := &ast.Package{file.Name.Name, nil, map[string]*ast.File{file.Name.Position.Filename: file}}
pkg := &ast.Package{file.Name.Name, nil, map[string]*ast.File{file.Name.NamePos.Filename: file}}
return CheckPackage(pkg, importer)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment