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
f38d2b80
Commit
f38d2b80
authored
Dec 19, 2008
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new []int literal
R=ken OCL=21568 CL=21568
parent
dcc064fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
walk.c
src/cmd/gc/walk.c
+42
-1
No files found.
src/cmd/gc/walk.c
View file @
f38d2b80
...
...
@@ -3450,7 +3450,7 @@ loop:
}
Node
*
arraylit
(
Node
*
n
)
old
arraylit
(
Node
*
n
)
{
Iter
saver
;
Type
*
t
;
...
...
@@ -3500,6 +3500,47 @@ loop:
goto
loop
;
}
Node
*
arraylit
(
Node
*
n
)
{
Iter
saver
;
Type
*
t
;
Node
*
var
,
*
r
,
*
a
,
*
nas
,
*
nnew
,
*
ncon
;
int
idx
;
t
=
n
->
type
;
if
(
t
->
etype
!=
TARRAY
)
fatal
(
"arraylit: not array"
);
if
(
t
->
bound
>=
0
)
fatal
(
"arraylit: literal fixed arrays not implemented"
);
var
=
nod
(
OXXX
,
N
,
N
);
tempname
(
var
,
t
);
nnew
=
nod
(
ONEW
,
N
,
N
);
nnew
->
type
=
t
;
nas
=
nod
(
OAS
,
var
,
nnew
);
addtop
=
list
(
addtop
,
nas
);
idx
=
0
;
r
=
listfirst
(
&
saver
,
&
n
->
left
);
if
(
r
!=
N
&&
r
->
op
==
OEMPTY
)
r
=
N
;
while
(
r
!=
N
)
{
// build list of var[c] = expr
a
=
nodintconst
(
idx
);
a
=
nod
(
OINDEX
,
var
,
a
);
a
=
nod
(
OAS
,
a
,
r
);
addtop
=
list
(
addtop
,
a
);
idx
++
;
r
=
listnext
(
&
saver
);
}
nnew
->
left
=
nodintconst
(
idx
);
return
var
;
}
Node
*
maplit
(
Node
*
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