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