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
65d397f7
Commit
65d397f7
authored
Apr 16, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler implementation of array slice change
R=ken OCL=27533 CL=27533
parent
37a5374c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
walk.c
src/cmd/gc/walk.c
+13
-7
No files found.
src/cmd/gc/walk.c
View file @
65d397f7
...
...
@@ -1956,7 +1956,13 @@ ascompat(Type *dst, Type *src)
if
(
eqtype
(
dst
,
src
,
0
))
return
1
;
if
(
isslice
(
dst
)
&&
isfixedarray
(
src
)
&&
eqtype
(
dst
->
type
,
src
->
type
,
0
))
if
(
dst
==
T
||
src
==
T
)
return
0
;
if
(
isslice
(
dst
)
&&
isptr
[
src
->
etype
]
&&
isfixedarray
(
src
->
type
)
&&
eqtype
(
dst
->
type
,
src
->
type
->
type
,
0
))
return
1
;
if
(
isnilinter
(
dst
)
||
isnilinter
(
src
))
...
...
@@ -2194,6 +2200,8 @@ stringop(Node *n, int top)
case
OARRAY
:
// arraystring([]byte) string;
r
=
n
->
left
;
if
(
isfixedarray
(
r
->
type
))
r
=
nod
(
OADDR
,
r
,
N
);
on
=
syslook
(
"arraystring"
,
0
);
r
=
nod
(
OCALL
,
on
,
r
);
break
;
...
...
@@ -2716,7 +2724,7 @@ arrayop(Node *n, int top)
case
OAS
:
// arrays2d(old *any, nel int) (ary []any)
t
=
fixarray
(
n
->
right
->
type
);
t
=
fixarray
(
n
->
right
->
type
->
type
);
tl
=
fixarray
(
n
->
left
->
type
);
if
(
t
==
T
||
tl
==
T
)
break
;
...
...
@@ -2726,9 +2734,7 @@ arrayop(Node *n, int top)
a
->
type
=
types
[
TINT
];
r
=
a
;
a
=
nod
(
OADDR
,
n
->
right
,
N
);
// old
addrescapes
(
n
->
right
);
r
=
list
(
a
,
r
);
r
=
list
(
n
->
right
,
r
);
// old
on
=
syslook
(
"arrays2d"
,
1
);
argtype
(
on
,
t
);
// any-1
...
...
@@ -3019,8 +3025,8 @@ convas(Node *n)
goto
out
;
}
if
(
isslice
(
lt
)
&&
is
fixedarray
(
rt
))
{
if
(
!
eqtype
(
lt
->
type
->
type
,
rt
->
type
->
type
,
0
))
if
(
isslice
(
lt
)
&&
is
ptr
[
rt
->
etype
]
&&
isfixedarray
(
rt
->
type
))
{
if
(
!
eqtype
(
lt
->
type
->
type
,
rt
->
type
->
type
->
type
,
0
))
goto
bad
;
indir
(
n
,
arrayop
(
n
,
Etop
));
goto
out
;
...
...
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