mirror of
https://github.com/golang/go
synced 2024-11-24 14:30:17 -07:00
gc: keep track of real actual type of identifiers.
R=rsc CC=golang-dev https://golang.org/cl/2519042
This commit is contained in:
parent
9c20485268
commit
49a835fc97
@ -41,7 +41,7 @@ enum
|
|||||||
AMEMWORD,
|
AMEMWORD,
|
||||||
|
|
||||||
BADWIDTH = -1000000000,
|
BADWIDTH = -1000000000,
|
||||||
MAXWIDTH = 1<<30
|
MAXWIDTH = 1<<30
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -636,9 +637,9 @@ EXTERN Label* labellist;
|
|||||||
*
|
*
|
||||||
* typedef struct
|
* typedef struct
|
||||||
* { // must not move anything
|
* { // must not move anything
|
||||||
* uchar array[8]; // pointer to data
|
* uchar array[8]; // pointer to data
|
||||||
* uchar nel[4]; // number of elements
|
* uchar nel[4]; // number of elements
|
||||||
* uchar cap[4]; // allocated number of elements
|
* uchar cap[4]; // allocated number of elements
|
||||||
* } Array;
|
* } Array;
|
||||||
*/
|
*/
|
||||||
EXTERN int Array_array; // runtime offsetof(Array,array) - same for String
|
EXTERN int Array_array; // runtime offsetof(Array,array) - same for String
|
||||||
@ -653,8 +654,8 @@ EXTERN int sizeof_Array; // runtime sizeof(Array)
|
|||||||
*
|
*
|
||||||
* typedef struct
|
* typedef struct
|
||||||
* { // must not move anything
|
* { // must not move anything
|
||||||
* uchar array[8]; // pointer to data
|
* uchar array[8]; // pointer to data
|
||||||
* uchar nel[4]; // number of elements
|
* uchar nel[4]; // number of elements
|
||||||
* } String;
|
* } String;
|
||||||
*/
|
*/
|
||||||
EXTERN int sizeof_String; // runtime sizeof(String)
|
EXTERN int sizeof_String; // runtime sizeof(String)
|
||||||
|
@ -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)
|
|||||||
t->len = strlen(s);
|
t->len = strlen(s);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user