]> Cypherpunks repositories - gostls13.git/commitdiff
include local types in typestrings
authorRuss Cox <rsc@golang.org>
Tue, 21 Oct 2008 22:57:38 +0000 (15:57 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 21 Oct 2008 22:57:38 +0000 (15:57 -0700)
R=r
DELTA=16  (14 added, 1 deleted, 1 changed)
OCL=17584
CL=17584

src/cmd/6l/go.c

index 2d17bbe964394f442b832c52d12ee248502709ee..7182cf00a98a73aae169f2848de9f208e03cf8e2 100644 (file)
@@ -90,16 +90,17 @@ ldpkg(Biobuf *f, int64 len, char *filename)
                fprint(2, "6l: short pkg read %s\n", filename);
                return;
        }
+
+       // first $$ marks beginning of exports
        p0 = strstr(data, "$$");
        if(p0 == nil)
                return;
        p0 += 2;
        while(*p0 != '\n' && *p0 != '\0')
                p0++;
-
        p1 = strstr(p0, "$$");
        if(p1 == nil) {
-               fprint(2, "6l: cannot find end of imports in %s\n", filename);
+               fprint(2, "6l: cannot find end of exports in %s\n", filename);
                return;
        }
        while(*p0 == ' ' || *p0 == '\t' || *p0 == '\n')
@@ -115,6 +116,18 @@ ldpkg(Biobuf *f, int64 len, char *filename)
                p0++;
 
        loadpkgdata(filename, p0, p1 - p0);
+
+       // local types begin where exports end.
+       p0 = p1;
+       while(*p0 != '\n' && *p0 != '\0')
+               p0++;
+       p1 = strstr(p0, "$$");
+       if(p1 == nil) {
+               fprint(2, "6l: cannot find end of local types in %s\n", filename);
+               return;
+       }
+
+       loadpkgdata(filename, p0, p1 - p0);
 }
 
 static void