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
1423bf3d
Commit
1423bf3d
authored
Sep 03, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
structure literals
R=r OCL=14735 CL=14735
parent
30aa83ca
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
26 deletions
+22
-26
gen.c
src/cmd/6g/gen.c
+3
-4
subr.c
src/cmd/gc/subr.c
+17
-0
walk.c
src/cmd/gc/walk.c
+2
-22
No files found.
src/cmd/6g/gen.c
View file @
1423bf3d
...
...
@@ -137,6 +137,9 @@ gen(Node *n, Label *labloop)
loop:
if
(
n
==
N
)
goto
ret
;
if
(
n
->
ninit
)
gen
(
n
->
ninit
,
L
);
setlineno
(
n
);
switch
(
n
->
op
)
{
...
...
@@ -234,7 +237,6 @@ loop:
break
;
case
OFOR
:
gen
(
n
->
ninit
,
L
);
// init
p1
=
gbranch
(
AJMP
,
T
);
// goto test
sbreak
=
breakpc
;
breakpc
=
gbranch
(
AJMP
,
T
);
// break: goto done
...
...
@@ -256,7 +258,6 @@ loop:
break
;
case
OIF
:
gen
(
n
->
ninit
,
L
);
// init
p1
=
gbranch
(
AJMP
,
T
);
// goto test
p2
=
gbranch
(
AJMP
,
T
);
// p2: goto else
patch
(
p1
,
pc
);
// test:
...
...
@@ -269,7 +270,6 @@ loop:
break
;
case
OSWITCH
:
gen
(
n
->
ninit
,
L
);
// init
p1
=
gbranch
(
AJMP
,
T
);
// goto test
sbreak
=
breakpc
;
breakpc
=
gbranch
(
AJMP
,
T
);
// break: goto done
...
...
@@ -284,7 +284,6 @@ loop:
break
;
case
OSELECT
:
gen
(
n
->
ninit
,
L
);
sbreak
=
breakpc
;
p1
=
gbranch
(
AJMP
,
T
);
// goto test
breakpc
=
gbranch
(
AJMP
,
T
);
// break: goto done
...
...
src/cmd/gc/subr.c
View file @
1423bf3d
...
...
@@ -1220,6 +1220,23 @@ isptrdarray(Type *t)
return
0
;
}
int
isselect
(
Node
*
n
)
{
Sym
*
s
;
if
(
n
==
N
)
return
0
;
n
=
n
->
left
;
s
=
pkglookup
(
"selectsend"
,
"sys"
);
if
(
s
==
n
->
sym
)
return
1
;
s
=
pkglookup
(
"selectrecv"
,
"sys"
);
if
(
s
==
n
->
sym
)
return
1
;
return
0
;
}
int
isinter
(
Type
*
t
)
{
...
...
src/cmd/gc/walk.c
View file @
1423bf3d
...
...
@@ -21,23 +21,6 @@ walk(Node *fn)
dump
(
"fn"
,
fn
->
nbody
);
}
int
isselect
(
Node
*
n
)
{
Sym
*
s
;
if
(
n
==
N
)
return
0
;
n
=
n
->
left
;
s
=
pkglookup
(
"selectsend"
,
"sys"
);
if
(
s
==
n
->
sym
)
return
1
;
s
=
pkglookup
(
"selectrecv"
,
"sys"
);
if
(
s
==
n
->
sym
)
return
1
;
return
0
;
}
void
walktype1
(
Node
*
n
,
int
top
)
{
...
...
@@ -396,8 +379,6 @@ loop:
goto
ret
;
convlit
(
l
,
t
);
if
(
l
->
type
==
T
)
goto
ret
;
// nil conversion
if
(
eqtype
(
t
,
l
->
type
,
0
))
{
...
...
@@ -415,6 +396,7 @@ loop:
}
// to string
if
(
l
->
type
!=
T
)
if
(
isptrto
(
t
,
TSTRING
))
{
if
(
isint
[
l
->
type
->
etype
])
{
*
n
=
*
stringop
(
n
,
top
);
...
...
@@ -2331,7 +2313,7 @@ walktype(Node *n, int top)
r
=
addtop
;
addtop
=
N
;
walktype1
(
r
,
top
);
n
->
ninit
=
list
(
r
,
n
->
ninit
);
n
->
ninit
=
list
(
n
->
ninit
,
r
);
}
}
...
...
@@ -2830,8 +2812,6 @@ structlit(Node *n)
if
(
t
->
etype
!=
TSTRUCT
)
fatal
(
"structlit: not struct"
);
print
(
"
\n
struct lit %lT
\n
"
,
t
);
var
=
nod
(
OXXX
,
N
,
N
);
tempname
(
var
,
t
);
...
...
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