1
0
mirror of https://github.com/golang/go synced 2024-11-13 19:10:22 -07:00

6g ninit fixes - fixes the two test cases

i isolated last night.  does not fix rob's
interface-smashing bug.

R=ken
OCL=18698
CL=18698
This commit is contained in:
Russ Cox 2008-11-06 13:31:13 -08:00
parent 66c6b13b03
commit 9906bfc7bb
4 changed files with 20 additions and 5 deletions

View File

@ -478,6 +478,8 @@ EXTERN ushort block; // current block number
EXTERN Node* retnil;
EXTERN Node* fskel;
EXTERN Node* addtop;
EXTERN char* context;
EXTERN int thechar;
EXTERN char* thestring;

View File

@ -303,6 +303,9 @@ Bvardcl:
}
| new_name_list_r type '=' expr_list
{
if(addtop != N)
fatal("new_name_list_r type '=' expr_list");
$$ = rev($1);
dodclvar($$, $2);
@ -423,6 +426,9 @@ simple_stmt:
}
| exprsym3_list_r LCOLAS expr_list
{
if(addtop != N)
fatal("exprsym3_list_r LCOLAS expr_list");
$$ = rev($1);
$$ = colas($$, $3);
$$ = nod(OAS, $$, $3);

View File

@ -2417,20 +2417,20 @@ adddot(Node *n)
walktype(n->left, Erv);
t = n->left->type;
if(t == T)
return n;
goto ret;
if(n->right->op != ONAME)
return n;
goto ret;
s = n->right->sym;
if(s == S)
return n;
goto ret;
for(d=0; d<nelem(dotlist); d++) {
c = adddot1(s, t, d);
if(c > 0)
goto out;
}
return n;
goto ret;
out:
if(c > 1)
@ -2441,6 +2441,9 @@ out:
n = nod(ODOT, n, n->right);
n->left->right = newname(dotlist[c].field->sym);
}
ret:
n->ninit = list(addtop, n->ninit);
addtop = N;
return n;
}

View File

@ -8,7 +8,6 @@ static Type* sw1(Node*, Type*);
static Type* sw2(Node*, Type*);
static Type* sw3(Node*, Type*);
static Node* curfn;
static Node* addtop;
enum
{
@ -65,6 +64,8 @@ walk(Node *fn)
if(curfn->type->outtuple)
if(walkret(curfn->nbody))
yyerror("function ends without a return statement");
if(addtop != N)
fatal("addtop in walk");
walkstate(curfn->nbody);
if(debug['W']) {
snprint(s, sizeof(s), "after %S", curfn->nname->sym);
@ -1544,6 +1545,9 @@ walkdot(Node *n)
{
Type *t;
addtop = list(addtop, n->ninit);
n->ninit = N;
if(n->left == N || n->right == N)
return;
switch(n->op) {