1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:44:41 -07:00

exp/types: properly read dotted identifiers

Fixes #3682.

R=rsc
CC=golang-dev
https://golang.org/cl/6256067
This commit is contained in:
Robert Griesemer 2012-05-29 13:15:13 -07:00
parent 12b2022a3b
commit bd7c626348
3 changed files with 6 additions and 8 deletions

View File

@ -182,7 +182,7 @@ func (p *gcParser) init(filename, id string, src io.Reader, imports map[string]*
func (p *gcParser) next() {
p.tok = p.scanner.Scan()
switch p.tok {
case scanner.Ident, scanner.Int, scanner.String:
case scanner.Ident, scanner.Int, scanner.String, '·':
p.lit = p.scanner.TokenText()
default:
p.lit = ""

View File

@ -92,13 +92,6 @@ func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) {
}
func TestGcImport(t *testing.T) {
// Dies trying to read crypto/md5, which contains
// const init1 = 0x...
// The importer believes init1 should be a function for some reason.
// golang.org/issue/3682.
t.Logf("broken; skipping")
return
// On cross-compile builds, the path will not exist.
// Need to use GOHOSTOS, which is not available.
if _, err := os.Stat(gcPath); err != nil {

View File

@ -11,6 +11,11 @@ import (
"go/ast"
)
// Issue 3682: Correctly read dotted identifiers from export data.
const init1 = 0
func init() {}
const (
C0 int = 0
C1 = 3.14159265