1
0
mirror of https://github.com/golang/go synced 2024-11-22 21:10:03 -07:00
R=r
OCL=29409
CL=29409
This commit is contained in:
Ken Thompson 2009-05-26 16:30:35 -07:00
parent 5ecd010beb
commit 51ddddc67e

View File

@ -2349,8 +2349,11 @@ stringop(Node *n, int top)
case OLT: case OLT:
// sys_cmpstring(s1, s2) :: 0 // sys_cmpstring(s1, s2) :: 0
on = syslook("cmpstring", 0); on = syslook("cmpstring", 0);
r = list(n->left, n->right); r = nod(OCONV, n->left, N);
r = nod(OCALL, on, r); r->type = types[TSTRING];
c = nod(OCONV, n->right, N);
c->type = types[TSTRING];
r = nod(OCALL, on, list(r, c));
c = nodintconst(0); c = nodintconst(0);
r = nod(n->op, r, c); r = nod(n->op, r, c);
break; break;
@ -2358,8 +2361,11 @@ stringop(Node *n, int top)
case OADD: case OADD:
// sys_catstring(s1, s2) // sys_catstring(s1, s2)
on = syslook("catstring", 0); on = syslook("catstring", 0);
r = list(n->left, n->right); r = nod(OCONV, n->left, N);
r = nod(OCALL, on, r); r->type = types[TSTRING];
c = nod(OCONV, n->right, N);
c->type = types[TSTRING];
r = nod(OCALL, on, list(r, c));
break; break;
case OASOP: case OASOP:
@ -2372,9 +2378,12 @@ stringop(Node *n, int top)
// s1 = sys_catstring(s1, s2) // s1 = sys_catstring(s1, s2)
if(n->etype != OADD) if(n->etype != OADD)
fatal("stringop: not cat"); fatal("stringop: not cat");
r = list(n->left, n->right);
on = syslook("catstring", 0); on = syslook("catstring", 0);
r = nod(OCALL, on, r); r = nod(OCONV, n->left, N);
r->type = types[TSTRING];
c = nod(OCONV, n->right, N);
c->type = types[TSTRING];
r = nod(OCALL, on, list(r, c));
r = nod(OAS, n->left, r); r = nod(OAS, n->left, r);
break; break;
} }