]> Cypherpunks repositories - gostls13.git/commitdiff
exp/types: fix crash in parseBasicType on unknown type
authorRuss Cox <rsc@golang.org>
Wed, 19 Oct 2011 16:49:01 +0000 (12:49 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 19 Oct 2011 16:49:01 +0000 (12:49 -0400)
R=gri
CC=golang-dev
https://golang.org/cl/5302044

src/pkg/exp/types/gcimporter.go

index fe90f91080771f3f7b4a027a92bb7b59ee25d356..e744a63a96ec965bcd7294a3b1ac5c50e0b1cda4 100644 (file)
@@ -289,9 +289,10 @@ func (p *gcParser) parseExportedName() (*ast.Object, string) {
 // BasicType = identifier .
 //
 func (p *gcParser) parseBasicType() Type {
-       obj := Universe.Lookup(p.expect(scanner.Ident))
+       id := p.expect(scanner.Ident)
+       obj := Universe.Lookup(id)
        if obj == nil || obj.Kind != ast.Typ {
-               p.errorf("not a basic type: %s", obj.Name)
+               p.errorf("not a basic type: %s", id)
        }
        return obj.Type.(Type)
 }