1
0
mirror of https://github.com/golang/go synced 2024-11-23 04:20:03 -07:00

import/export of embedded types

R=ken
OCL=17643
CL=17643
This commit is contained in:
Russ Cox 2008-10-22 13:22:56 -07:00
parent 40fa690d75
commit 21617250f4
2 changed files with 15 additions and 4 deletions

View File

@ -73,7 +73,7 @@
%type <type> indcl fnlitdcl
%type <val> hidden_constant
%type <node> hidden_dcl
%type <node> hidden_dcl hidden_structdcl
%type <type> hidden_type hidden_type1 hidden_type2
%type <node> hidden_structdcl_list ohidden_structdcl_list hidden_structdcl_list_r
%type <node> 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
{

View File

@ -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);