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
814320c8
Commit
814320c8
authored
Jul 17, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parameter in fn literals
SVN=127695
parent
80038494
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
19 deletions
+20
-19
gen.c
src/cmd/6g/gen.c
+3
-1
dcl.c
src/cmd/gc/dcl.c
+15
-15
go.h
src/cmd/gc/go.h
+2
-1
walk.c
src/cmd/gc/walk.c
+0
-2
No files found.
src/cmd/6g/gen.c
View file @
814320c8
...
...
@@ -102,7 +102,7 @@ allocparams(void)
* parameters, is the offset in the
* parameter list.
*/
d
=
paramdcl
->
forw
;
;
d
=
curfn
->
type
->
param
->
forw
;
t
=
funcfirst
(
&
list
,
curfn
->
type
);
while
(
t
!=
T
)
{
if
(
d
==
D
)
...
...
@@ -117,6 +117,7 @@ allocparams(void)
if
(
n
->
class
!=
PPARAM
)
fatal
(
"allocparams: this & in class %N %d"
,
n
,
n
->
class
);
//print("assign %S %ld\n", n->sym, t->width);
n
->
xoffset
=
t
->
width
;
d
=
d
->
forw
;
t
=
funcnext
(
&
list
);
...
...
@@ -127,6 +128,7 @@ allocparams(void)
if
(
t
->
nname
!=
N
&&
t
->
nname
->
sym
->
name
[
0
]
!=
'_'
)
{
if
(
d
==
D
)
fatal
(
"allocparams: out nil"
);
if
(
d
->
op
!=
ONAME
)
{
d
=
d
->
forw
;
continue
;
...
...
src/cmd/gc/dcl.c
View file @
814320c8
...
...
@@ -364,39 +364,39 @@ funchdr(Node *n)
}
void
funcargs
(
Type
*
t
)
funcargs
(
Type
*
f
t
)
{
Type
*
n1
;
Type
*
t
;
Iter
save
;
int
all
;
paramdcl
=
autodcl
->
back
;
// base of arguments - see allocparams in gen.c
ft
->
param
=
autodcl
->
back
;
// base of arguments - see allocparams in gen.c
// declare the this/in arguments
n1
=
funcfirst
(
&
save
,
t
);
while
(
n1
!=
T
)
{
if
(
n1
->
nname
!=
N
)
addvar
(
n1
->
nname
,
n1
->
type
,
PPARAM
);
n1
=
funcnext
(
&
save
);
t
=
funcfirst
(
&
save
,
f
t
);
while
(
t
!=
T
)
{
if
(
t
->
nname
!=
N
)
addvar
(
t
->
nname
,
t
->
type
,
PPARAM
);
t
=
funcnext
(
&
save
);
}
// declare the outgoing arguments
all
=
0
;
n1
=
structfirst
(
&
save
,
getoutarg
(
t
));
while
(
n1
!=
T
)
{
if
(
n1
->
nname
!=
N
&&
n1
->
nname
->
sym
->
name
[
0
]
!=
'_'
)
{
addvar
(
n1
->
nname
,
n1
->
type
,
PPARAM
);
t
=
structfirst
(
&
save
,
getoutarg
(
f
t
));
while
(
t
!=
T
)
{
if
(
t
->
nname
!=
N
&&
t
->
nname
->
sym
->
name
[
0
]
!=
'_'
)
{
addvar
(
t
->
nname
,
t
->
type
,
PPARAM
);
all
|=
1
;
}
else
all
|=
2
;
n1
=
structnext
(
&
save
);
t
=
structnext
(
&
save
);
}
if
(
all
==
3
)
yyerror
(
"output parameters are all named or not named"
);
t
->
outnamed
=
0
;
f
t
->
outnamed
=
0
;
if
(
all
==
1
)
t
->
outnamed
=
1
;
f
t
->
outnamed
=
1
;
}
/*
...
...
src/cmd/gc/go.h
View file @
814320c8
...
...
@@ -68,6 +68,7 @@ struct Val
typedef
struct
Sym
Sym
;
typedef
struct
Node
Node
;
typedef
struct
Type
Type
;
typedef
struct
Dcl
Dcl
;
struct
Type
{
...
...
@@ -84,6 +85,7 @@ struct Type
Sym
*
sym
;
long
vargen
;
// unique name for OTYPE/ONAME
Dcl
*
param
;
// most nodes
Type
*
type
;
...
...
@@ -173,7 +175,6 @@ struct Sym
};
#define S ((Sym*)0)
typedef
struct
Dcl
Dcl
;
struct
Dcl
{
uchar
op
;
...
...
src/cmd/gc/walk.c
View file @
814320c8
...
...
@@ -1179,8 +1179,6 @@ prcompat(Node *n)
loop:
if
(
l
==
N
)
{
if
(
r
==
N
)
return
nod
(
OBAD
,
N
,
N
);
walktype
(
r
,
Etop
);
return
r
;
}
...
...
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