]> Cypherpunks repositories - gostls13.git/commitdiff
import/export of embedded types
authorRuss Cox <rsc@golang.org>
Wed, 22 Oct 2008 20:22:56 +0000 (13:22 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 22 Oct 2008 20:22:56 +0000 (13:22 -0700)
R=ken
OCL=17643
CL=17643

src/cmd/gc/go.y
src/cmd/gc/subr.c

index 352d60c9fdd7be0937fec671e71e58bdd564ab17..5a7eae468e58bbaf93cd2f84574d0aa63a1008df 100644 (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
        {
index ba5f698900890c937a37eb1495eb6a701a2e44c8..b66bd2bc8a2f0501fa7230fef58c259bcbb52e5c 100644 (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);