cmd/cgo: recognize untyped constants defined in different files

An untyped constant can be defined in any input file, we shouldn't
segregate them by file.

Updates #28772

Change-Id: I0347f15236833bb511eb49f86c449ee9241b0a25
Reviewed-on: https://go-review.googlesource.com/c/151600
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
Ian Lance Taylor 2018-11-28 16:02:15 -08:00
parent 048580d341
commit 4f26f24d2a
5 changed files with 18 additions and 5 deletions

View file

@ -1233,7 +1233,7 @@ func (p *Package) isConst(f *File, x ast.Expr) bool {
strings.HasPrefix(x.Name, "_Ciconst_") ||
strings.HasPrefix(x.Name, "_Cfconst_") ||
strings.HasPrefix(x.Name, "_Csconst_") ||
f.Consts[x.Name]
consts[x.Name]
case *ast.UnaryExpr:
return p.isConst(f, x.X)
case *ast.BinaryExpr: