From 21617250f4b94af3ec0d79e7192573a7de80d31c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 22 Oct 2008 13:22:56 -0700 Subject: [PATCH] import/export of embedded types R=ken OCL=17643 CL=17643 --- src/cmd/gc/go.y | 17 ++++++++++++++--- src/cmd/gc/subr.c | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/cmd/gc/go.y b/src/cmd/gc/go.y index 352d60c9fdd..5a7eae468e5 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 ba5f6989008..b66bd2bc8a2 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);