Commit 077fe408 authored by Ken Thompson's avatar Ken Thompson

bug with struct literal with metods

R=r
OCL=14937
CL=14937
parent 0194aaf9
...@@ -2882,9 +2882,17 @@ structlit(Node *n) ...@@ -2882,9 +2882,17 @@ structlit(Node *n)
r = listfirst(&saver, &n->left); r = listfirst(&saver, &n->left);
loop: 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 || r == N) {
if(l != T || r != N) if(l != T)
yyerror("error in shape struct literal"); yyerror("struct literal expect expr of type %T", l);
if(r != N)
yyerror("struct literal too many expressions");
return var; return var;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment