Commit 49a835fc authored by Luuk van Dijk's avatar Luuk van Dijk

gc: keep track of real actual type of identifiers.

R=rsc
CC=golang-dev
https://golang.org/cl/2519042
parent 9c204852
......@@ -218,6 +218,7 @@ struct Node
Node* left;
Node* right;
Type* type;
Type* realtype; // as determined by typecheck
NodeList* list;
NodeList* rlist;
......
......@@ -3607,10 +3607,11 @@ umagic(Magic *m)
Sym*
ngotype(Node *n)
{
if(n->sym != S && strncmp(n->sym->name, "autotmp_", 8) != 0)
if(n->type->etype != TFUNC || n->type->thistuple == 0)
if(n->type->etype != TSTRUCT || n->type->funarg == 0)
return typename(n->type)->left->sym;
if(n->sym != S && n->realtype != T)
if(strncmp(n->sym->name, "autotmp_", 8) != 0)
if(strncmp(n->sym->name, "statictmp_", 8) != 0)
return typename(n->realtype)->left->sym;
return S;
}
......@@ -3684,4 +3685,3 @@ strlit(char *s)
t->len = strlen(s);
return t;
}
......@@ -112,6 +112,7 @@ typecheck(Node **np, int top)
goto error;
}
walkdef(n);
n->realtype = n->type;
if(n->op == ONONAME)
goto error;
}
......
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