Commit e733766d authored by Russ Cox's avatar Russ Cox

gc: minor import grammar bug fixes

Fixes #364.

R=ken2
https://golang.org/cl/164092
parent d984f989
...@@ -85,7 +85,9 @@ ...@@ -85,7 +85,9 @@
%type <list> hidden_interfacedcl_list ohidden_interfacedcl_list %type <list> hidden_interfacedcl_list ohidden_interfacedcl_list
%type <list> hidden_structdcl_list ohidden_structdcl_list %type <list> hidden_structdcl_list ohidden_structdcl_list
%type <type> hidden_type hidden_type1 hidden_type2 hidden_pkgtype %type <type> hidden_type hidden_type_misc hidden_pkgtype
%type <type> hidden_type_func hidden_type_non_func
%type <type> hidden_type_chan hidden_type_non_chan
%left LOROR %left LOROR
%left LANDAND %left LANDAND
...@@ -1613,10 +1615,19 @@ hidden_pkgtype: ...@@ -1613,10 +1615,19 @@ hidden_pkgtype:
} }
hidden_type: hidden_type:
hidden_type1 hidden_type_misc
| hidden_type2 | hidden_type_chan
| hidden_type_func
hidden_type1: hidden_type_non_chan:
hidden_type_misc
| hidden_type_func
hidden_type_non_func:
hidden_type_misc
| hidden_type_chan
hidden_type_misc:
hidden_importsym hidden_importsym
{ {
$$ = pkgtype($1); $$ = pkgtype($1);
...@@ -1662,25 +1673,33 @@ hidden_type1: ...@@ -1662,25 +1673,33 @@ hidden_type1:
$$->type = $3; $$->type = $3;
$$->chan = Crecv; $$->chan = Crecv;
} }
| LCHAN LCOMM hidden_type1 | LCHAN LCOMM hidden_type_non_chan
{ {
$$ = typ(TCHAN); $$ = typ(TCHAN);
$$->type = $3; $$->type = $3;
$$->chan = Csend; $$->chan = Csend;
} }
| LCHAN LCOMM '(' hidden_type_chan ')'
{
$$ = typ(TCHAN);
$$->type = $4;
$$->chan = Csend;
}
| LDDD | LDDD
{ {
$$ = typ(TDDD); $$ = typ(TDDD);
} }
hidden_type2: hidden_type_chan:
LCHAN hidden_type LCHAN hidden_type
{ {
$$ = typ(TCHAN); $$ = typ(TCHAN);
$$->type = $2; $$->type = $2;
$$->chan = Cboth; $$->chan = Cboth;
} }
| LFUNC '(' ohidden_funarg_list ')' ohidden_funres
hidden_type_func:
LFUNC '(' ohidden_funarg_list ')' ohidden_funres
{ {
$$ = functype(nil, $3, $5); $$ = functype(nil, $3, $5);
} }
...@@ -1732,7 +1751,7 @@ hidden_funres: ...@@ -1732,7 +1751,7 @@ hidden_funres:
{ {
$$ = $2; $$ = $2;
} }
| hidden_type1 | hidden_type_non_func
{ {
$$ = list1(nod(ODCLFIELD, N, typenod($1))); $$ = list1(nod(ODCLFIELD, N, typenod($1)));
} }
......
package chanbug
var C chan<- (chan int)
var D chan<- func()
var E func() chan int
var F func() (func())
package Bar
import _ "chanbug"
// $G $D/$F.dir/chanbug.go && $G -I. $D/$F.dir/chanbug2.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
ignored
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment