Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
d122bb21
Commit
d122bb21
authored
Dec 15, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: double-check usage of ...
Fixes #423. R=ken2
https://golang.org/cl/180045
parent
0282cc5e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
5 deletions
+34
-5
dcl.c
src/cmd/gc/dcl.c
+7
-3
go.h
src/cmd/gc/go.h
+1
-1
go.y
src/cmd/gc/go.y
+7
-1
bug228.go
test/fixedbugs/bug228.go
+19
-0
No files found.
src/cmd/gc/dcl.c
View file @
d122bb21
...
@@ -961,7 +961,7 @@ findtype(NodeList *l)
...
@@ -961,7 +961,7 @@ findtype(NodeList *l)
}
}
NodeList
*
NodeList
*
checkarglist
(
NodeList
*
all
)
checkarglist
(
NodeList
*
all
,
int
input
)
{
{
int
named
;
int
named
;
Node
*
n
,
*
t
,
*
nextt
;
Node
*
n
,
*
t
,
*
nextt
;
...
@@ -1015,8 +1015,12 @@ checkarglist(NodeList *all)
...
@@ -1015,8 +1015,12 @@ checkarglist(NodeList *all)
if
(
n
!=
N
)
if
(
n
!=
N
)
n
=
newname
(
n
->
sym
);
n
=
newname
(
n
->
sym
);
n
=
nod
(
ODCLFIELD
,
n
,
t
);
n
=
nod
(
ODCLFIELD
,
n
,
t
);
if
(
l
->
next
!=
nil
&&
n
->
right
!=
N
&&
n
->
right
->
op
==
OTYPE
&&
isddd
(
n
->
right
->
type
))
if
(
n
->
right
!=
N
&&
n
->
right
->
op
==
OTYPE
&&
isddd
(
n
->
right
->
type
))
{
yyerror
(
"only last argument can have type ..."
);
if
(
!
input
)
yyerror
(
"cannot use ... in output argument list"
);
else
if
(
l
->
next
!=
nil
)
yyerror
(
"can only use ... as final argument in list"
);
}
l
->
n
=
n
;
l
->
n
=
n
;
}
}
return
all
;
return
all
;
...
...
src/cmd/gc/go.h
View file @
d122bb21
...
@@ -955,7 +955,7 @@ Type* newtype(Sym*);
...
@@ -955,7 +955,7 @@ Type* newtype(Sym*);
Type
*
oldtype
(
Sym
*
);
Type
*
oldtype
(
Sym
*
);
void
fninit
(
NodeList
*
);
void
fninit
(
NodeList
*
);
Node
*
nametodcl
(
Node
*
,
Type
*
);
Node
*
nametodcl
(
Node
*
,
Type
*
);
NodeList
*
checkarglist
(
NodeList
*
);
NodeList
*
checkarglist
(
NodeList
*
,
int
);
void
checkwidth
(
Type
*
);
void
checkwidth
(
Type
*
);
void
defercheckwidth
(
void
);
void
defercheckwidth
(
void
);
void
resumecheckwidth
(
void
);
void
resumecheckwidth
(
void
);
...
...
src/cmd/gc/go.y
View file @
d122bb21
...
@@ -1070,6 +1070,7 @@ fndcl:
...
@@ -1070,6 +1070,7 @@ fndcl:
{
{
Node *n;
Node *n;
$3 = checkarglist($3, 1);
$$ = nod(ODCLFUNC, N, N);
$$ = nod(ODCLFUNC, N, N);
$$->nname = $1;
$$->nname = $1;
if($3 == nil && $5 == nil)
if($3 == nil && $5 == nil)
...
@@ -1085,6 +1086,8 @@ fndcl:
...
@@ -1085,6 +1086,8 @@ fndcl:
{
{
Node *rcvr, *t;
Node *rcvr, *t;
$2 = checkarglist($2, 0);
$6 = checkarglist($6, 1);
$$ = N;
$$ = N;
if($2 == nil) {
if($2 == nil) {
yyerror("method has no receiver");
yyerror("method has no receiver");
...
@@ -1113,6 +1116,7 @@ fndcl:
...
@@ -1113,6 +1116,7 @@ fndcl:
fntype:
fntype:
LFUNC '
(
' oarg_type_list_ocomma '
)
' fnres
LFUNC '
(
' oarg_type_list_ocomma '
)
' fnres
{
{
$3 = checkarglist($3, 1);
$$ = nod(OTFUNC, N, N);
$$ = nod(OTFUNC, N, N);
$$->list = $3;
$$->list = $3;
$$->rlist = $5;
$$->rlist = $5;
...
@@ -1140,6 +1144,7 @@ fnres:
...
@@ -1140,6 +1144,7 @@ fnres:
}
}
| '
(
' oarg_type_list_ocomma '
)
'
| '
(
' oarg_type_list_ocomma '
)
'
{
{
$2 = checkarglist($2, 0);
$$ = $2;
$$ = $2;
}
}
...
@@ -1280,6 +1285,7 @@ indcl:
...
@@ -1280,6 +1285,7 @@ indcl:
'
(
' oarg_type_list_ocomma '
)
' fnres
'
(
' oarg_type_list_ocomma '
)
' fnres
{
{
// without func keyword
// without func keyword
$2 = checkarglist($2, 0);
$$ = nod(OTFUNC, fakethis(), N);
$$ = nod(OTFUNC, fakethis(), N);
$$->list = $2;
$$->list = $2;
$$->rlist = $4;
$$->rlist = $4;
...
@@ -1320,7 +1326,7 @@ oarg_type_list_ocomma:
...
@@ -1320,7 +1326,7 @@ oarg_type_list_ocomma:
}
}
| arg_type_list ocomma
| arg_type_list ocomma
{
{
$$ =
checkarglist($1)
;
$$ =
$1
;
}
}
/*
/*
...
...
test/fixedbugs/bug228.go
0 → 100644
View file @
d122bb21
// errchk $G -e $D/$F.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.
package
main
func
f
(
x
int
,
y
...
)
// ok
func
g
(
x
int
,
y
float
)
(
...
)
// ERROR "[.][.][.]"
func
h
(
x
,
y
...
)
// ERROR "[.][.][.]"
func
i
(
x
int
,
y
...
,
z
float
)
// ERROR "[.][.][.]"
var
x
...
;
// ERROR "[.][.][.]|syntax"
type
T
...
;
// ERROR "[.][.][.]|syntax"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment