continue;
et = t->etype;
- if(et != TSTRUCT && et != TINTER)
+ if(t->method == T && et != TINTER)
continue;
s = d->dsym;
t = d->dtype;
et = t->etype;
- if(et != TSTRUCT && et != TINTER)
+ if(t->method == T && et != TINTER)
continue;
s = d->dsym;
}
n->type = *getoutarg(t);
- if(t->outtuple == 1)
+ switch(t->outtuple) {
+ case 0:
+ if(top == Erv) {
+ yyerror("function requires a return type");
+ n->type = types[TINT32];
+ }
+ break;
+
+ case 1:
n->type = n->type->type->type;
+ break;
+ }
walktype(n->right, Erv);
if(f->sym != s)
continue;
if(r != T) {
- yyerror("ambiguous DOT reference %s", s->name);
+ yyerror("ambiguous DOT reference %S", s);
break;
}
r = f;
f = lookdot(n->right, t->method);
if(f == T) {
- yyerror("undefined DOT %s", n->right->sym->name);
+ yyerror("undefined DOT %S", n->right->sym);
return;
}
// return 1;
if(isinter(t1))
- if(isptrto(t2, TSTRUCT) || isinter(t2))
+ if(ismethod(t2) || isinter(t2))
return 1;
if(isinter(t2))
- if(isptrto(t1, TSTRUCT))
+ if(ismethod(t1))
return 1;
if(isptrdarray(t1))
loop:
if(l == N) {
- walktype(r, Erv);
+ walktype(r, Etop);
return r;
}
on = syslook("panicl", 0);
n = nodintconst(lineno);
n = nod(OCALL, on, n);
- walktype(n, Erv);
+ walktype(n, Etop);
return n;
}
argtype(on, t->type); // any-4
r = nod(OCALL, on, r);
- walktype(r, Erv);
+ walktype(r, Etop);
break;
assign2:
argtype(on, t->type); // any-4
r = nod(OCALL, on, r);
- walktype(r, Erv);
+ walktype(r, Etop);
break;
access2:
if(isinter(t))
if(t->sym == S)
yyerror("interface type must be named");
- if(isptrto(t, TSTRUCT))
+ if(ismethod(t))
if(t->type == T || t->type->sym == S)
yyerror("structure type must be named");
}
rt = r->type;
if(isinter(lt)) {
- if(isptrto(rt, TSTRUCT)) {
+ if(ismethod(rt)) {
o = OS2I;
goto ret;
}
}
}
- if(isptrto(lt, TSTRUCT)) {
+ if(ismethod(lt)) {
if(isinter(rt)) {
o = OI2S;
goto ret;