mirror of
https://github.com/golang/go
synced 2024-11-18 21:05:02 -07:00
i2s and i2i
R=r OCL=14140 CL=14140
This commit is contained in:
parent
8c89767c72
commit
ead7a6d47a
@ -303,6 +303,7 @@ void
|
|||||||
agen_inter(Node *n, Node *res)
|
agen_inter(Node *n, Node *res)
|
||||||
{
|
{
|
||||||
Node nodo, nodr, nodt;
|
Node nodo, nodr, nodt;
|
||||||
|
Node *var;
|
||||||
Sym *s;
|
Sym *s;
|
||||||
char *e;
|
char *e;
|
||||||
int32 o,lno;
|
int32 o,lno;
|
||||||
@ -355,9 +356,10 @@ agen_inter(Node *n, Node *res)
|
|||||||
|
|
||||||
nodo.xoffset = 1*widthptr;
|
nodo.xoffset = 1*widthptr;
|
||||||
if(!n->left->addable) {
|
if(!n->left->addable) {
|
||||||
agen(n->left, &nodr);
|
var = nod(OXXX, N, N);
|
||||||
gmove(&nodr, &nodo);
|
tempname(var, n->left->type);
|
||||||
fatal("agen_inter i2i");
|
cgen(n->left, var);
|
||||||
|
cgen(var, &nodo);
|
||||||
} else {
|
} else {
|
||||||
cgen(n->left, &nodo);
|
cgen(n->left, &nodo);
|
||||||
}
|
}
|
||||||
@ -380,9 +382,10 @@ agen_inter(Node *n, Node *res)
|
|||||||
|
|
||||||
nodo.xoffset = 1*widthptr;
|
nodo.xoffset = 1*widthptr;
|
||||||
if(!n->left->addable) {
|
if(!n->left->addable) {
|
||||||
agen(n->left, &nodr);
|
var = nod(OXXX, N, N);
|
||||||
gmove(&nodr, &nodo);
|
tempname(var, n->left->type);
|
||||||
fatal("agen_inter i2s");
|
cgen(n->left, var);
|
||||||
|
cgen(var, &nodo);
|
||||||
} else {
|
} else {
|
||||||
cgen(n->left, &nodo);
|
cgen(n->left, &nodo);
|
||||||
}
|
}
|
||||||
|
@ -250,14 +250,14 @@ enum
|
|||||||
OPTR, OARRAY,
|
OPTR, OARRAY,
|
||||||
ORETURN, OFOR, OIF, OSWITCH, OI2S, OS2I, OI2I,
|
ORETURN, OFOR, OIF, OSWITCH, OI2S, OS2I, OI2I,
|
||||||
OAS, OASOP, OCASE, OXCASE, OSCASE, OFALL, OXFALL,
|
OAS, OASOP, OCASE, OXCASE, OSCASE, OFALL, OXFALL,
|
||||||
OGOTO, OPROC, ONEW, OPANIC, OPRINT, OEMPTY, OSELECT,
|
OGOTO, OPROC, ONEW, OEMPTY, OSELECT,
|
||||||
|
OLEN, OPANIC, OPRINT, OTYPEOF,
|
||||||
|
|
||||||
OOROR,
|
OOROR,
|
||||||
OANDAND,
|
OANDAND,
|
||||||
OEQ, ONE, OLT, OLE, OGE, OGT,
|
OEQ, ONE, OLT, OLE, OGE, OGT,
|
||||||
OADD, OSUB, OOR, OXOR,
|
OADD, OSUB, OOR, OXOR,
|
||||||
OMUL, ODIV, OMOD, OLSH, ORSH, OAND,
|
OMUL, ODIV, OMOD, OLSH, ORSH, OAND,
|
||||||
OLEN,
|
|
||||||
OFUNC,
|
OFUNC,
|
||||||
OLABEL,
|
OLABEL,
|
||||||
OBREAK,
|
OBREAK,
|
||||||
|
@ -18,15 +18,15 @@
|
|||||||
%token <sym> LPACKAGE LIMPORT LEXPORT
|
%token <sym> LPACKAGE LIMPORT LEXPORT
|
||||||
%token <sym> LMAP LCHAN LINTERFACE LFUNC LSTRUCT
|
%token <sym> LMAP LCHAN LINTERFACE LFUNC LSTRUCT
|
||||||
%token <sym> LCOLAS LFALL LRETURN
|
%token <sym> LCOLAS LFALL LRETURN
|
||||||
%token <sym> LNEW LLEN
|
%token <sym> LNEW LLEN LTYPEOF LPANIC LPRINT
|
||||||
%token <sym> LVAR LTYPE LCONST LCONVERT LSELECT
|
%token <sym> LVAR LTYPE LCONST LCONVERT LSELECT
|
||||||
%token <sym> LFOR LIF LELSE LSWITCH LCASE LDEFAULT
|
%token <sym> LFOR LIF LELSE LSWITCH LCASE LDEFAULT
|
||||||
%token <sym> LBREAK LCONTINUE LGO LGOTO LRANGE
|
%token <sym> LBREAK LCONTINUE LGO LGOTO LRANGE
|
||||||
%token <sym> LNIL LTRUE LFALSE LIOTA
|
%token <sym> LNIL LTRUE LFALSE LIOTA
|
||||||
%token <sym> LPANIC LPRINT LIGNORE
|
|
||||||
|
|
||||||
%token LOROR LANDAND LEQ LNE LLE LLT LGE LGT
|
%token LOROR LANDAND LEQ LNE LLE LLT LGE LGT
|
||||||
%token LLSH LRSH LINC LDEC LSEND LRECV
|
%token LLSH LRSH LINC LDEC LSEND LRECV
|
||||||
|
%token LIGNORE
|
||||||
|
|
||||||
%type <sym> sym sym1 sym2 key1 key2 laconst lname latype
|
%type <sym> sym sym1 sym2 key1 key2 laconst lname latype
|
||||||
%type <lint> chandir
|
%type <lint> chandir
|
||||||
@ -733,6 +733,11 @@ pexpr:
|
|||||||
{
|
{
|
||||||
$$ = nod(OLEN, $3, N);
|
$$ = nod(OLEN, $3, N);
|
||||||
}
|
}
|
||||||
|
| LTYPEOF '(' type ')'
|
||||||
|
{
|
||||||
|
$$ = nod(OTYPEOF, N, N);
|
||||||
|
$$->type = $3;
|
||||||
|
}
|
||||||
| LNEW '(' type ')'
|
| LNEW '(' type ')'
|
||||||
{
|
{
|
||||||
$$ = nod(ONEW, N, N);
|
$$ = nod(ONEW, N, N);
|
||||||
@ -852,6 +857,7 @@ key1:
|
|||||||
| LPRINT
|
| LPRINT
|
||||||
| LNEW
|
| LNEW
|
||||||
| LBASETYPE
|
| LBASETYPE
|
||||||
|
| LTYPEOF
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* keywords that we can
|
* keywords that we can
|
||||||
@ -884,7 +890,6 @@ key2:
|
|||||||
| LGO
|
| LGO
|
||||||
| LGOTO
|
| LGOTO
|
||||||
| LRANGE
|
| LRANGE
|
||||||
| LIGNORE
|
|
||||||
|
|
||||||
name:
|
name:
|
||||||
lname
|
lname
|
||||||
|
@ -981,12 +981,12 @@ static struct
|
|||||||
"chan", LCHAN, Txxx,
|
"chan", LCHAN, Txxx,
|
||||||
"const", LCONST, Txxx,
|
"const", LCONST, Txxx,
|
||||||
"continue", LCONTINUE, Txxx,
|
"continue", LCONTINUE, Txxx,
|
||||||
"convert", LCONVERT, Txxx, // should be a var
|
"convert", LCONVERT, Txxx,
|
||||||
"default", LDEFAULT, Txxx,
|
"default", LDEFAULT, Txxx,
|
||||||
"else", LELSE, Txxx,
|
"else", LELSE, Txxx,
|
||||||
"export", LEXPORT, Txxx,
|
"export", LEXPORT, Txxx,
|
||||||
"fallthrough", LFALL, Txxx,
|
"fallthrough", LFALL, Txxx,
|
||||||
"false", LFALSE, Txxx, // should be a var
|
"false", LFALSE, Txxx,
|
||||||
"for", LFOR, Txxx,
|
"for", LFOR, Txxx,
|
||||||
"func", LFUNC, Txxx,
|
"func", LFUNC, Txxx,
|
||||||
"go", LGO, Txxx,
|
"go", LGO, Txxx,
|
||||||
@ -996,19 +996,20 @@ static struct
|
|||||||
"interface", LINTERFACE, Txxx,
|
"interface", LINTERFACE, Txxx,
|
||||||
"iota", LIOTA, Txxx,
|
"iota", LIOTA, Txxx,
|
||||||
"map", LMAP, Txxx,
|
"map", LMAP, Txxx,
|
||||||
"new", LNEW, Txxx, // should be a var
|
"new", LNEW, Txxx,
|
||||||
"len", LLEN, Txxx, // should be a var
|
"len", LLEN, Txxx,
|
||||||
"nil", LNIL, Txxx, // should be a var
|
"nil", LNIL, Txxx,
|
||||||
"package", LPACKAGE, Txxx,
|
"package", LPACKAGE, Txxx,
|
||||||
"panic", LPANIC, Txxx, // temp
|
"panic", LPANIC, Txxx,
|
||||||
"print", LPRINT, Txxx, // temp
|
"print", LPRINT, Txxx,
|
||||||
"range", LRANGE, Txxx,
|
"range", LRANGE, Txxx,
|
||||||
"return", LRETURN, Txxx,
|
"return", LRETURN, Txxx,
|
||||||
"select", LSELECT, Txxx,
|
"select", LSELECT, Txxx,
|
||||||
"struct", LSTRUCT, Txxx,
|
"struct", LSTRUCT, Txxx,
|
||||||
"switch", LSWITCH, Txxx,
|
"switch", LSWITCH, Txxx,
|
||||||
"true", LTRUE, Txxx, // should be a var
|
"true", LTRUE, Txxx,
|
||||||
"type", LTYPE, Txxx,
|
"type", LTYPE, Txxx,
|
||||||
|
"typeof", LTYPEOF, Txxx,
|
||||||
"var", LVAR, Txxx,
|
"var", LVAR, Txxx,
|
||||||
|
|
||||||
"notwithstanding", LIGNORE, Txxx,
|
"notwithstanding", LIGNORE, Txxx,
|
||||||
|
Loading…
Reference in New Issue
Block a user