summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-05-24 15:25:30 -0700
committerRuss Cox <rsc@golang.org>2010-05-24 15:25:30 -0700
commit65de060c17fecc01dce7be598ba017f05ae37367 (patch)
treec3ff4e1741fa1c83894382a16a05f7dff8854634 /src/cmd
parent2a5057255a82896e1e0c0224e62c94ce4a74bbc5 (diff)
downloadgolang-65de060c17fecc01dce7be598ba017f05ae37367.tar.gz
gc: bug277 - new conversion syntax
R=ken2 CC=golang-dev http://codereview.appspot.com/1220046
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/gc/go.y31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/cmd/gc/go.y b/src/cmd/gc/go.y
index 2af6057e7..8128e8608 100644
--- a/src/cmd/gc/go.y
+++ b/src/cmd/gc/go.y
@@ -70,7 +70,7 @@
%type <list> interfacedcl_list vardcl vardcl_list structdcl structdcl_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> recvchantype non_recvchantype othertype fnret_type fntype
@@ -822,7 +822,7 @@ pexpr:
$$ = nod(OCALL, $1, N);
$$->list = list1($3);
}
-| convtype lbrace braced_keyval_list '}'
+| comptype lbrace braced_keyval_list '}'
{
// composite expression
$$ = nod(OCOMPLIT, N, $1);
@@ -886,7 +886,7 @@ sym:
LNAME
name:
- sym
+ sym %prec NotParen
{
$$ = oldname($1);
if($$->pack != N)
@@ -896,24 +896,6 @@ name:
labelname:
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
* channel types
@@ -963,6 +945,13 @@ non_recvchantype:
$$ = $2;
}
+convtype:
+ fntype
+| othertype
+
+comptype:
+ othertype
+
fnret_type:
recvchantype
| fntype