1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:07:58 -07:00

gc: bug277 - new conversion syntax

R=ken2
CC=golang-dev
https://golang.org/cl/1220046
This commit is contained in:
Russ Cox 2010-05-24 15:25:30 -07:00
parent 43c0a46ac6
commit 2e9b67afa6
2 changed files with 10 additions and 21 deletions

View File

@ -70,7 +70,7 @@
%type <list> interfacedcl_list vardcl vardcl_list structdcl structdcl_list %type <list> interfacedcl_list vardcl vardcl_list structdcl structdcl_list
%type <list> common_dcl constdcl constdcl1 constdcl_list typedcl_list %type <list> common_dcl constdcl constdcl1 constdcl_list typedcl_list
%type <node> convtype dotdotdot %type <node> convtype comptype dotdotdot
%type <node> indcl interfacetype structtype ptrtype %type <node> indcl interfacetype structtype ptrtype
%type <node> recvchantype non_recvchantype othertype fnret_type fntype %type <node> recvchantype non_recvchantype othertype fnret_type fntype
@ -822,7 +822,7 @@ pexpr:
$$ = nod(OCALL, $1, N); $$ = nod(OCALL, $1, N);
$$->list = list1($3); $$->list = list1($3);
} }
| convtype lbrace braced_keyval_list '}' | comptype lbrace braced_keyval_list '}'
{ {
// composite expression // composite expression
$$ = nod(OCOMPLIT, N, $1); $$ = nod(OCOMPLIT, N, $1);
@ -886,7 +886,7 @@ sym:
LNAME LNAME
name: name:
sym sym %prec NotParen
{ {
$$ = oldname($1); $$ = oldname($1);
if($$->pack != N) if($$->pack != N)
@ -896,24 +896,6 @@ name:
labelname: labelname:
new_name new_name
convtype:
'[' oexpr ']' ntype
{
// array literal
$$ = nod(OTARRAY, $2, $4);
}
| '[' LDDD ']' ntype
{
// array literal of nelem
$$ = nod(OTARRAY, nod(ODDD, N, N), $4);
}
| LMAP '[' ntype ']' ntype
{
// map literal
$$ = nod(OTMAP, $3, $5);
}
| structtype
/* /*
* to avoid parsing conflicts, type is split into * to avoid parsing conflicts, type is split into
* channel types * channel types
@ -963,6 +945,13 @@ non_recvchantype:
$$ = $2; $$ = $2;
} }
convtype:
fntype
| othertype
comptype:
othertype
fnret_type: fnret_type:
recvchantype recvchantype
| fntype | fntype