Commit d01a1ec2 authored by Ken Thompson's avatar Ken Thompson

robs wednesday bug

R=r
OCL=15327
CL=15327
parent 2119294a
......@@ -666,6 +666,8 @@ void doimport9(Sym*, Node*);
/*
* walk.c
*/
void addtotop(Node*);
void gettype(Node*, Node*);
void walk(Node*);
void walkstate(Node*);
void walktype(Node*, int);
......
......@@ -247,20 +247,22 @@ Bvardcl:
dodclvar($$, $2);
$$ = nod(OAS, $$, $4);
addtotop($$);
}
| new_name '=' expr
{
gettype($3);
$$ = nod(OAS, $1, N);
gettype($3, $$);
defaultlit($3);
dodclvar($1, $3->type);
$$ = nod(OAS, $1, $3);
$$->right = $3;
}
constdcl:
new_name type '=' expr
{
Node *c = treecopy($4);
gettype(c);
gettype(c, N);
convlit(c, $2);
dodclconst($1, c);
......@@ -270,7 +272,7 @@ constdcl:
| new_name '=' expr
{
Node *c = treecopy($3);
gettype(c);
gettype(c, N);
dodclconst($1, c);
lastconst = $3;
......@@ -282,7 +284,7 @@ constdcl1:
| new_name type
{
Node *c = treecopy(lastconst);
gettype(c);
gettype(c, N);
convlit(c, $2);
dodclconst($1, c);
......@@ -291,7 +293,7 @@ constdcl1:
| new_name
{
Node *c = treecopy(lastconst);
gettype(c);
gettype(c, N);
dodclconst($1, c);
iota += 1;
......
......@@ -76,12 +76,14 @@ addtotop(Node *n)
}
void
gettype(Node *n)
gettype(Node *n, Node *a)
{
if(debug['W'])
dump("\nbefore gettype", n);
walktype(n, Erv);
addtotop(n);
if(a == N && addtop != N)
fatal("gettype: addtop");
addtotop(a);
if(debug['W'])
dump("after gettype", n);
}
......
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