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
b46e7c4d
Commit
b46e7c4d
authored
May 27, 2009
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug 152
R=r OCL=29419 CL=29419
parent
1a0a6f9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
13 deletions
+22
-13
sinit.c
src/cmd/gc/sinit.c
+2
-2
walk.c
src/cmd/gc/walk.c
+20
-11
No files found.
src/cmd/gc/sinit.c
View file @
b46e7c4d
...
@@ -264,7 +264,7 @@ initsub(Node *n, Node *nam)
...
@@ -264,7 +264,7 @@ initsub(Node *n, Node *nam)
// out of this if we allow minimal simple
// out of this if we allow minimal simple
// expression on the right (eg OADDR-ONAME)
// expression on the right (eg OADDR-ONAME)
if
(
n
->
op
!=
ONAME
)
if
(
n
->
op
!=
ONAME
)
return
0
;
return
;
class
=
typeclass
(
nam
->
type
);
class
=
typeclass
(
nam
->
type
);
state
=
TS_start
;
state
=
TS_start
;
...
@@ -279,7 +279,7 @@ initsub(Node *n, Node *nam)
...
@@ -279,7 +279,7 @@ initsub(Node *n, Node *nam)
case
TC_map
:
case
TC_map
:
goto
map
;
goto
map
;
}
}
return
0
;
return
;
str:
str:
for
(
r
=
listfirst
(
&
iter
,
&
xxx
.
list
);
r
!=
N
;
r
=
listnext
(
&
iter
))
{
for
(
r
=
listfirst
(
&
iter
,
&
xxx
.
list
);
r
!=
N
;
r
=
listnext
(
&
iter
))
{
...
...
src/cmd/gc/walk.c
View file @
b46e7c4d
...
@@ -3580,7 +3580,7 @@ badt:
...
@@ -3580,7 +3580,7 @@ badt:
Node
*
Node
*
dorange
(
Node
*
nn
)
dorange
(
Node
*
nn
)
{
{
Node
*
k
,
*
v
,
*
m
;
Node
*
k
,
*
v
,
*
m
,
*
init
;
Node
*
n
,
*
hv
,
*
hc
,
*
ha
,
*
hk
,
*
ohk
,
*
on
,
*
r
,
*
a
;
Node
*
n
,
*
hv
,
*
hc
,
*
ha
,
*
hk
,
*
ohk
,
*
on
,
*
r
,
*
a
;
Type
*
t
,
*
th
;
Type
*
t
,
*
th
;
int
local
;
int
local
;
...
@@ -3596,6 +3596,7 @@ dorange(Node *nn)
...
@@ -3596,6 +3596,7 @@ dorange(Node *nn)
}
}
n
=
nod
(
OFOR
,
N
,
N
);
n
=
nod
(
OFOR
,
N
,
N
);
init
=
N
;
walktype
(
nn
->
right
,
Erv
);
walktype
(
nn
->
right
,
Erv
);
implicitstar
(
&
nn
->
right
);
implicitstar
(
&
nn
->
right
);
...
@@ -3624,8 +3625,11 @@ ary:
...
@@ -3624,8 +3625,11 @@ ary:
ha
=
nod
(
OXXX
,
N
,
N
);
// hidden array
ha
=
nod
(
OXXX
,
N
,
N
);
// hidden array
tempname
(
ha
,
t
);
tempname
(
ha
,
t
);
n
->
ninit
=
nod
(
OAS
,
hk
,
nodintconst
(
0
));
a
=
nod
(
OAS
,
hk
,
nodintconst
(
0
));
n
->
ninit
=
list
(
nod
(
OAS
,
ha
,
m
),
n
->
ninit
);
init
=
list
(
init
,
a
);
a
=
nod
(
OAS
,
ha
,
m
);
init
=
list
(
init
,
a
);
n
->
ntest
=
nod
(
OLT
,
hk
,
nod
(
OLEN
,
ha
,
N
));
n
->
ntest
=
nod
(
OLT
,
hk
,
nod
(
OLEN
,
ha
,
N
));
n
->
nincr
=
nod
(
OASOP
,
hk
,
nodintconst
(
1
));
n
->
nincr
=
nod
(
OASOP
,
hk
,
nodintconst
(
1
));
...
@@ -3659,7 +3663,8 @@ map:
...
@@ -3659,7 +3663,8 @@ map:
r
=
nod
(
OADDR
,
hk
,
N
);
r
=
nod
(
OADDR
,
hk
,
N
);
r
=
list
(
m
,
r
);
r
=
list
(
m
,
r
);
r
=
nod
(
OCALL
,
on
,
r
);
r
=
nod
(
OCALL
,
on
,
r
);
n
->
ninit
=
r
;
init
=
list
(
init
,
r
);
r
=
nod
(
OINDEX
,
hk
,
nodintconst
(
0
));
r
=
nod
(
OINDEX
,
hk
,
nodintconst
(
0
));
a
=
nod
(
OLITERAL
,
N
,
N
);
a
=
nod
(
OLITERAL
,
N
,
N
);
...
@@ -3706,10 +3711,13 @@ chan:
...
@@ -3706,10 +3711,13 @@ chan:
hv
=
nod
(
OXXX
,
N
,
N
);
// hidden value
hv
=
nod
(
OXXX
,
N
,
N
);
// hidden value
tempname
(
hv
,
t
->
type
);
tempname
(
hv
,
t
->
type
);
n
->
ninit
=
list
(
a
=
nod
(
OAS
,
hc
,
m
);
nod
(
OAS
,
hc
,
m
),
init
=
list
(
init
,
a
);
nod
(
OAS
,
hv
,
nod
(
ORECV
,
hc
,
N
))
);
a
=
nod
(
ORECV
,
hc
,
N
);
a
=
nod
(
OAS
,
hv
,
a
);
init
=
list
(
init
,
a
);
n
->
ntest
=
nod
(
ONOT
,
nod
(
OCLOSED
,
hc
,
N
),
N
);
n
->
ntest
=
nod
(
ONOT
,
nod
(
OCLOSED
,
hc
,
N
),
N
);
n
->
nincr
=
nod
(
OAS
,
hv
,
nod
(
ORECV
,
hc
,
N
));
n
->
nincr
=
nod
(
OAS
,
hv
,
nod
(
ORECV
,
hc
,
N
));
...
@@ -3743,11 +3751,11 @@ strng:
...
@@ -3743,11 +3751,11 @@ strng:
// ha = s
// ha = s
a
=
nod
(
OAS
,
ha
,
m
);
a
=
nod
(
OAS
,
ha
,
m
);
n
->
ninit
=
a
;
init
=
list
(
init
,
a
)
;
// ohk = 0
// ohk = 0
a
=
nod
(
OAS
,
ohk
,
nodintconst
(
0
));
a
=
nod
(
OAS
,
ohk
,
nodintconst
(
0
));
n
->
ninit
=
list
(
n
->
n
init
,
a
);
init
=
list
(
init
,
a
);
// hk[,hv] = stringiter(ha,hk)
// hk[,hv] = stringiter(ha,hk)
if
(
v
!=
N
)
{
if
(
v
!=
N
)
{
...
@@ -3764,7 +3772,7 @@ strng:
...
@@ -3764,7 +3772,7 @@ strng:
a
=
nod
(
OCALL
,
on
,
a
);
a
=
nod
(
OCALL
,
on
,
a
);
a
=
nod
(
OAS
,
hk
,
a
);
a
=
nod
(
OAS
,
hk
,
a
);
}
}
n
->
ninit
=
list
(
n
->
n
init
,
a
);
init
=
list
(
init
,
a
);
// while(hk != 0)
// while(hk != 0)
n
->
ntest
=
nod
(
ONE
,
hk
,
nodintconst
(
0
));
n
->
ntest
=
nod
(
ONE
,
hk
,
nodintconst
(
0
));
...
@@ -3799,6 +3807,7 @@ strng:
...
@@ -3799,6 +3807,7 @@ strng:
goto
out
;
goto
out
;
out:
out:
n
->
ninit
=
list
(
n
->
ninit
,
init
);
return
n
;
return
n
;
}
}
...
...
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