Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
80038494
Commit
80038494
authored
Jul 16, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parameter declartions in func literals
SVN=127678
parent
0e67654f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
7 deletions
+32
-7
src/cmd/6g/gen.c
src/cmd/6g/gen.c
+4
-3
src/cmd/gc/dcl.c
src/cmd/gc/dcl.c
+26
-0
src/cmd/gc/go.h
src/cmd/gc/go.h
+2
-0
src/cmd/gc/go.y
src/cmd/gc/go.y
+0
-4
No files found.
src/cmd/6g/gen.c
View file @
80038494
...
...
@@ -102,11 +102,12 @@ allocparams(void)
* parameters, is the offset in the
* parameter list.
*/
d
=
autodcl
;
d
=
paramdcl
->
forw
;
;
t
=
funcfirst
(
&
list
,
curfn
->
type
);
while
(
t
!=
T
)
{
if
(
d
==
D
)
fatal
(
"allocparams: this & in nil"
);
if
(
d
->
op
!=
ONAME
)
{
d
=
d
->
forw
;
continue
;
...
...
@@ -114,7 +115,7 @@ allocparams(void)
n
=
d
->
dnode
;
if
(
n
->
class
!=
PPARAM
)
fatal
(
"allocparams: this & in class
"
);
fatal
(
"allocparams: this & in class
%N %d"
,
n
,
n
->
class
);
n
->
xoffset
=
t
->
width
;
d
=
d
->
forw
;
...
...
@@ -133,7 +134,7 @@ allocparams(void)
n
=
d
->
dnode
;
if
(
n
->
class
!=
PPARAM
)
fatal
(
"allocparams: out class
"
);
fatal
(
"allocparams: out class
%N %d"
,
n
,
n
->
class
);
n
->
xoffset
=
t
->
width
;
d
=
d
->
forw
;
...
...
src/cmd/gc/dcl.c
View file @
80038494
...
...
@@ -370,6 +370,8 @@ funcargs(Type *t)
Iter
save
;
int
all
;
paramdcl
=
autodcl
->
back
;
// base of arguments - see allocparams in gen.c
// declare the this/in arguments
n1
=
funcfirst
(
&
save
,
t
);
while
(
n1
!=
T
)
{
...
...
@@ -601,6 +603,30 @@ markdclstack(void)
}
}
void
dumpdcl
(
char
*
st
)
{
Sym
*
s
,
*
d
;
int
i
;
print
(
"
\n
dumpdcl: %s %p
\n
"
,
st
,
b0stack
);
i
=
0
;
for
(
d
=
dclstack
;
d
!=
S
;
d
=
d
->
link
)
{
i
++
;
print
(
" %.2d %p"
,
i
,
d
);
if
(
d
==
b0stack
)
print
(
" (b0)"
);
if
(
d
->
name
==
nil
)
{
print
(
"
\n
"
);
continue
;
}
print
(
" '%s'"
,
d
->
name
);
s
=
pkglookup
(
d
->
name
,
d
->
package
);
print
(
" %lS
\n
"
,
s
);
}
}
void
testdclstack
(
void
)
{
...
...
src/cmd/gc/go.h
View file @
80038494
...
...
@@ -385,6 +385,7 @@ EXTERN vlong minintval[NTYPE];
EXTERN
vlong
maxintval
[
NTYPE
];
EXTERN
Dcl
*
autodcl
;
EXTERN
Dcl
*
paramdcl
;
EXTERN
Dcl
*
externdcl
;
EXTERN
Dcl
*
exportlist
;
EXTERN
int
dclcontext
;
// PEXTERN/PAUTO
...
...
@@ -529,6 +530,7 @@ Type* sortinter(Type*);
void
markdcl
(
void
);
void
popdcl
(
void
);
void
poptodcl
(
void
);
void
dumpdcl
(
char
*
);
void
markdclstack
(
void
);
void
testdclstack
(
void
);
Sym
*
pushdcl
(
Sym
*
);
...
...
src/cmd/gc/go.y
View file @
80038494
...
...
@@ -1024,7 +1024,6 @@ fnliteral:
$$
=
newname
(
lookup
(
namebuf
));
addvar
($$,
$
1
,
PEXTERN
);
dump
(
"lit1"
,
$$);
{
Node
*
n
;
...
...
@@ -1035,13 +1034,10 @@ dump("lit1", $$);
n
->
nbody
=
$
3
;
if
(
n
->
nbody
==
N
)
n
->
nbody
=
nod
(
ORETURN
,
N
,
N
);
dump
(
"comp1"
,
n
);
compile
(
n
);
dump
(
"comp2"
,
n
);
}
$$
=
nod
(
OADDR
,
$$,
N
);
dump
(
"lit2"
,
$$);
}
fnbody
:
...
...
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