Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(305)

Unified Diff: src/cmd/cgo/gcc.go

Issue 20150045: code review 20150045: [release-branch.go1.2] cmd/cgo: fix line number in an e... (Closed)
Patch Set: diff -r 2acdaa9fe432 https://code.google.com/p/go Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « misc/cgo/errors/test.bash ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/cgo/gcc.go
===================================================================
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -654,7 +654,7 @@
// Okay - might be new(T)
expr = r.Name.Type.Go
} else if r.Name.Kind == "var" {
- expr = &ast.StarExpr{X: expr}
+ expr = &ast.StarExpr{Star: (*r.Expr).Pos(), X: expr}
}
case "type":
@@ -683,6 +683,16 @@
}
}
}
+
+ // Copy position information from old expr into new expr,
+ // in case expression being replaced is first on line.
+ // See golang.org/issue/6563.
+ pos := (*r.Expr).Pos()
+ switch x := expr.(type) {
+ case *ast.Ident:
+ expr = &ast.Ident{NamePos: pos, Name: x.Name}
+ }
+
*r.Expr = expr
}
« no previous file with comments | « misc/cgo/errors/test.bash ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b