diff options
author | Ian Lance Taylor <iant@golang.org> | 2014-02-26 07:37:10 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2014-02-26 07:37:10 -0800 |
commit | 142ce7a76bcf7e4c10ee8730010ec9c9521a18f1 (patch) | |
tree | e7cb5e9d992eb01f3098f07eccfda6bbb4950952 /src/cmd/6g | |
parent | d99d747e15556c7806df1e499261f11a39596f2d (diff) | |
download | go-142ce7a76bcf7e4c10ee8730010ec9c9521a18f1.tar.gz |
cmd/6g, cmd/8g: simplify calls to gvardef
The gvardef function does nothing if n->class == PEXTERN, so
we don't need to test for that before calling it. This makes
the 6g/8g code more like the 5g code and clarifies that the
cases that do not test for n->class != PEXTERN are not buggy.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/68900044
Diffstat (limited to 'src/cmd/6g')
-rw-r--r-- | src/cmd/6g/cgen.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/6g/cgen.c b/src/cmd/6g/cgen.c index e1b5d1140..72ab0857e 100644 --- a/src/cmd/6g/cgen.c +++ b/src/cmd/6g/cgen.c @@ -1389,11 +1389,11 @@ sgen(Node *n, Node *ns, int64 w) if(n->ullman >= ns->ullman) { agenr(n, &nodr, N); - if(ns->op == ONAME && ns->class != PEXTERN) + if(ns->op == ONAME) gvardef(ns); agenr(ns, &nodl, N); } else { - if(ns->op == ONAME && ns->class != PEXTERN) + if(ns->op == ONAME) gvardef(ns); agenr(ns, &nodl, N); agenr(n, &nodr, N); @@ -1575,7 +1575,7 @@ componentgen(Node *nr, Node *nl) switch(nl->type->etype) { case TARRAY: // componentgen for arrays. - if(nl->op == ONAME && nl->class != PEXTERN) + if(nl->op == ONAME) gvardef(nl); t = nl->type; if(!isslice(t)) { @@ -1626,7 +1626,7 @@ componentgen(Node *nr, Node *nl) goto yes; case TSTRING: - if(nl->op == ONAME && nl->class != PEXTERN) + if(nl->op == ONAME) gvardef(nl); nodl.xoffset += Array_array; nodl.type = ptrto(types[TUINT8]); @@ -1651,7 +1651,7 @@ componentgen(Node *nr, Node *nl) goto yes; case TINTER: - if(nl->op == ONAME && nl->class != PEXTERN) + if(nl->op == ONAME) gvardef(nl); nodl.xoffset += Array_array; nodl.type = ptrto(types[TUINT8]); @@ -1676,7 +1676,7 @@ componentgen(Node *nr, Node *nl) goto yes; case TSTRUCT: - if(nl->op == ONAME && nl->class != PEXTERN) + if(nl->op == ONAME) gvardef(nl); loffset = nodl.xoffset; roffset = nodr.xoffset; |