cmd/cgo: also rewrite C.var in selector expressions

While we're here, rename TestIssue7234 to Test7234 for consistency
with other tests.

Fixes #9557.

Change-Id: I22b0a212b31e7b4f199f6a70deb73374beb80f84
Reviewed-on: https://go-review.googlesource.com/2654
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Shenghou Ma 2015-01-12 00:12:59 -05:00 committed by Minux Ma
parent a6cb053026
commit 16993f2485
4 changed files with 45 additions and 1 deletions

View file

@ -659,6 +659,13 @@ func (p *Package) rewriteRef(f *File) {
expr = &ast.StarExpr{Star: (*r.Expr).Pos(), X: expr}
}
case "selector":
if r.Name.Kind == "var" {
expr = &ast.StarExpr{Star: (*r.Expr).Pos(), X: expr}
} else {
error_(r.Pos(), "only C variables allowed in selector expression", fixGo(r.Name.Go))
}
case "type":
if r.Name.Kind != "type" {
error_(r.Pos(), "expression C.%s used as type", fixGo(r.Name.Go))