From: Russ Cox Date: Wed, 22 Oct 2008 20:22:56 +0000 (-0700) Subject: import/export of embedded types X-Git-Tag: weekly.2009-11-06~2917 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=21617250f4b94af3ec0d79e7192573a7de80d31c;p=gostls13.git import/export of embedded types R=ken OCL=17643 CL=17643 --- diff --git a/src/cmd/gc/go.y b/src/cmd/gc/go.y index 352d60c9fd..5a7eae468e 100644 --- a/src/cmd/gc/go.y +++ b/src/cmd/gc/go.y @@ -73,7 +73,7 @@ %type indcl fnlitdcl %type hidden_constant -%type hidden_dcl +%type hidden_dcl hidden_structdcl %type hidden_type hidden_type1 hidden_type2 %type hidden_structdcl_list ohidden_structdcl_list hidden_structdcl_list_r %type hidden_interfacedcl_list ohidden_interfacedcl_list hidden_interfacedcl_list_r @@ -1580,8 +1580,8 @@ hidden_funarg_list: } hidden_structdcl_list_r: - hidden_dcl -| hidden_structdcl_list_r ';' hidden_dcl + hidden_structdcl +| hidden_structdcl_list_r ';' hidden_structdcl { $$ = nod(OLIST, $1, $3); } @@ -1847,6 +1847,17 @@ hidden_dcl: $$->type = $2; } +hidden_structdcl: + sym1 hidden_type + { + $$ = nod(ODCLFIELD, newname($1), N); + $$->type = $2; + } +| '?' hidden_type + { + $$ = embedded($2->sym); + } + hidden_interfacedcl: sym1 '(' ohidden_funarg_list ')' ohidden_funres { diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index ba5f698900..b66bd2bc8a 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -1061,7 +1061,7 @@ Tpretty(Fmt *fp, Type *t) return fmtprint(fp, " }"); case TFIELD: - if(t->sym == S || t->sym->name[0] == '_') { + if(t->sym == S || t->sym->name[0] == '_' || t->embedded) { if(exporting) fmtprint(fp, "? "); return fmtprint(fp, "%T", t->type);