mirror of
https://github.com/golang/go.git
synced 2024-09-22 02:48:50 +00:00
cmd/cgo: in -godefs mode, don't change constant to type
Fixes #39534 Change-Id: Icbc1745935dd7098c09e2d35c61cd5bfbaa31c63 Reviewed-on: https://go-review.googlesource.com/c/go/+/237558 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
f7ba82d68f
commit
a5a9a06d71
12
misc/cgo/testgodefs/testdata/issue39534.go
vendored
Normal file
12
misc/cgo/testgodefs/testdata/issue39534.go
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
// enum { ENUMVAL = 0x1 };
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
const ENUMVAL = C.ENUMVAL
|
@ -24,6 +24,7 @@ var filePrefixes = []string{
|
|||||||
"issue37479",
|
"issue37479",
|
||||||
"issue37621",
|
"issue37621",
|
||||||
"issue38649",
|
"issue38649",
|
||||||
|
"issue39534",
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGoDefs(t *testing.T) {
|
func TestGoDefs(t *testing.T) {
|
||||||
|
@ -1354,7 +1354,7 @@ func (p *Package) rewriteRef(f *File) {
|
|||||||
|
|
||||||
if *godefs {
|
if *godefs {
|
||||||
// Substitute definition for mangled type name.
|
// Substitute definition for mangled type name.
|
||||||
if r.Name.Type != nil {
|
if r.Name.Type != nil && r.Name.Kind == "type" {
|
||||||
expr = r.Name.Type.Go
|
expr = r.Name.Type.Go
|
||||||
}
|
}
|
||||||
if id, ok := expr.(*ast.Ident); ok {
|
if id, ok := expr.(*ast.Ident); ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user