From: Russ Cox Date: Tue, 21 Oct 2008 22:57:38 +0000 (-0700) Subject: include local types in typestrings X-Git-Tag: weekly.2009-11-06~2926 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2c3ddf5ef6755e7a559128b6e55bf93aa6c78157;p=gostls13.git include local types in typestrings R=r DELTA=16 (14 added, 1 deleted, 1 changed) OCL=17584 CL=17584 --- diff --git a/src/cmd/6l/go.c b/src/cmd/6l/go.c index 2d17bbe964..7182cf00a9 100644 --- a/src/cmd/6l/go.c +++ b/src/cmd/6l/go.c @@ -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