]> Cypherpunks repositories - gostls13.git/commitdiff
exp/types: properly read dotted identifiers
authorRobert Griesemer <gri@golang.org>
Tue, 29 May 2012 20:15:13 +0000 (13:15 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 29 May 2012 20:15:13 +0000 (13:15 -0700)
Fixes #3682.

R=rsc
CC=golang-dev
https://golang.org/cl/6256067

src/pkg/exp/types/gcimporter.go
src/pkg/exp/types/gcimporter_test.go
src/pkg/exp/types/testdata/exports.go

index af1eef804af4eef8bdbe78f9d4cc6078a04d3d94..f584c39091be4652d63ff5812fddb6a45b061ad1 100644 (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 = ""
index c39b47b06265cc62310d1b8cc320581ff85fdb84..20247b0dc44c9dfceda55e8f9dba308461d65e3e 100644 (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 {
index ed63bf9adec099c13e6cfaea10a8fe9b564b916e..8ee28b0942b69cab01baef4e6203a6ce12c63c26 100644 (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