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
e683fb7a
Commit
e683fb7a
authored
Dec 12, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug104
R=r OCL=21082 CL=21082
parent
9dfb2ea7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
17 deletions
+28
-17
const.c
src/cmd/gc/const.c
+26
-16
go.h
src/cmd/gc/go.h
+1
-0
walk.c
src/cmd/gc/walk.c
+1
-1
No files found.
src/cmd/gc/const.c
View file @
e683fb7a
...
...
@@ -34,7 +34,7 @@ truncfltlit(Mpflt *fv, Type *t)
}
void
convlit
(
Node
*
n
,
Type
*
t
)
convlit
1
(
Node
*
n
,
Type
*
t
,
int
conv
)
{
int
et
,
wt
;
...
...
@@ -92,21 +92,6 @@ convlit(Node *n, Type *t)
defaultlit
(
n
);
return
;
}
if
(
isptrto
(
t
,
TSTRING
))
{
Rune
rune
;
int
l
;
String
*
s
;
rune
=
mpgetfix
(
n
->
val
.
u
.
xval
);
l
=
runelen
(
rune
);
s
=
mal
(
sizeof
(
*
s
)
+
l
);
s
->
len
=
l
;
runetochar
((
char
*
)(
s
->
s
),
&
rune
);
n
->
val
.
u
.
sval
=
s
;
n
->
val
.
ctype
=
CTSTR
;
break
;
}
if
(
isint
[
et
])
{
// int to int
if
(
mpcmpfixfix
(
n
->
val
.
u
.
xval
,
minintval
[
et
])
<
0
)
...
...
@@ -132,6 +117,25 @@ convlit(Node *n, Type *t)
truncfltlit
(
fv
,
t
);
break
;
}
if
(
!
conv
)
goto
bad1
;
// only done as string(CONST)
if
(
isptrto
(
t
,
TSTRING
))
{
Rune
rune
;
int
l
;
String
*
s
;
rune
=
mpgetfix
(
n
->
val
.
u
.
xval
);
l
=
runelen
(
rune
);
s
=
mal
(
sizeof
(
*
s
)
+
l
);
s
->
len
=
l
;
runetochar
((
char
*
)(
s
->
s
),
&
rune
);
n
->
val
.
u
.
sval
=
s
;
n
->
val
.
ctype
=
CTSTR
;
break
;
}
goto
bad1
;
case
Wlitfloat
:
...
...
@@ -186,6 +190,12 @@ bad3:
return
;
}
void
convlit
(
Node
*
n
,
Type
*
t
)
{
convlit1
(
n
,
t
,
0
);
}
void
evconst
(
Node
*
n
)
{
...
...
src/cmd/gc/go.h
View file @
e683fb7a
...
...
@@ -822,6 +822,7 @@ Node* old2new(Node*, Type*);
/*
* const.c
*/
void
convlit1
(
Node
*
,
Type
*
,
int
);
void
convlit
(
Node
*
,
Type
*
);
void
evconst
(
Node
*
);
int
cmpslit
(
Node
*
l
,
Node
*
r
);
...
...
src/cmd/gc/walk.c
View file @
e683fb7a
...
...
@@ -560,7 +560,7 @@ loop:
goto
ret
;
if
(
!
iscomposite
(
t
))
convlit
(
l
,
t
);
convlit
1
(
l
,
t
,
1
);
// nil conversion
if
(
eqtype
(
t
,
l
->
type
,
0
))
{
...
...
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