case TPTR64:
if(t->type == T)
fatal("dumpexporttype: ptr %S", s);
+ if(t->type->etype == TFORW) {
+ yyerror("export of a undefined forward reference: %S", s);
+ break;
+ }
makeexportsym(t->type);
ts = t->type->sym;
if(ts->exported == 0)
ONAME, ONONAME,
ODOT, ODOTPTR, ODOTMETH, ODOTINTER,
ODCLFUNC, ODCLFIELD, ODCLARG,
- OLIST, OCMP,
- OPTR, OARRAY,
+ OLIST, OCMP, OPTR, OARRAY,
ORETURN, OFOR, OIF, OSWITCH,
OAS, OASOP, OCASE, OXCASE, OFALL, OXFALL,
OGOTO, OPROC, ONEW, OEMPTY, OSELECT,
}
| convtype '{' keyexpr_list '}'
{
- // struct literal and conversions
- $$ = nod(OCONV, rev($3), N);
+ // composite literal
+ $$ = rev($3);
+ if($$ == N)
+ $$ = nod(OEMPTY, N, N);
+ $$ = nod(OCONV, $$, N);
$$->type = $1;
}
| fnliteral
$$->type = types[TINT32];
};
}
-| LIMPORT structdcl
- {
- $$ = $2;
- $$->etype = OIMPORT;
- }
interfacedcl:
new_name ',' interfacedcl
* to check whether the rest of the grammar is free of
* reduce/reduce conflicts, comment this section out by
* removing the slash on the next line.
- *
+ */
lpack:
LATYPE
{
walkselect(n);
goto ret;
- case OEMPTY:
- if(top != Etop)
- goto nottop;
- goto ret;
-
case OIF:
if(top != Etop)
goto nottop;
case OFALL:
case OINDREG:
+ case OEMPTY:
goto ret;
case OCONV:
if(top == Etop)
goto nottop;
- walktype(n->left, Erv);
l = n->left;
if(l == N)
goto ret;
+ walktype(l, Erv);
+
t = n->type;
if(t == T)
goto ret;
// interface and structure
et = isandss(n->type, l);
if(et != Inone) {
-if(et == I2I) dump("conv", n);
indir(n, ifaceop(n->type, l, et));
goto ret;
}
l = structfirst(&savel, &n->type);
r = listfirst(&saver, &n->left);
+ if(r != N && r->op == OEMPTY)
+ r = N;
loop:
- if(l != T && l->etype == TFIELD && l->type->etype == TFUNC) {
- // skip methods
- l = structnext(&savel);
- goto loop;
- }
-
if(l == T || r == N) {
if(l != T)
yyerror("struct literal expect expr of type %T", l);
// make it a closed array
r = listfirst(&saver, &n->left);
+ if(r != N && r->op == OEMPTY)
+ r = N;
for(idx=0; r!=N; idx++)
r = listnext(&saver);
t->bound = idx;
idx = 0;
r = listfirst(&saver, &n->left);
+ if(r != N && r->op == OEMPTY)
+ r = N;
loop:
if(r == N)
addtop = list(addtop, a);
r = listfirst(&saver, &n->left);
+ if(r != N && r->op == OEMPTY)
+ r = N;
loop:
if(r == N) {