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
44fd7573
Commit
44fd7573
authored
Mar 03, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc, ld: reflect support for PtrTo
R=ken2 CC=golang-dev
https://golang.org/cl/4245055
parent
2d404c4b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
reflect.c
src/cmd/gc/reflect.c
+29
-1
go.c
src/cmd/ld/go.c
+3
-1
No files found.
src/cmd/gc/reflect.c
View file @
44fd7573
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
static
NodeList
*
signatlist
;
static
NodeList
*
signatlist
;
static
Sym
*
dtypesym
(
Type
*
);
static
Sym
*
dtypesym
(
Type
*
);
static
Sym
*
weaktypesym
(
Type
*
);
static
int
static
int
sigcmp
(
Sig
*
a
,
Sig
*
b
)
sigcmp
(
Sig
*
a
,
Sig
*
b
)
...
@@ -570,9 +571,17 @@ dcommontype(Sym *s, int ot, Type *t)
...
@@ -570,9 +571,17 @@ dcommontype(Sym *s, int ot, Type *t)
{
{
int
i
;
int
i
;
Sym
*
s1
;
Sym
*
s1
;
Sym
*
sptr
;
char
*
p
;
char
*
p
;
dowidth
(
t
);
dowidth
(
t
);
sptr
=
nil
;
if
(
t
->
sym
!=
nil
&&
!
isptr
[
t
->
etype
])
sptr
=
dtypesym
(
ptrto
(
t
));
else
sptr
=
weaktypesym
(
ptrto
(
t
));
s1
=
dextratype
(
t
);
s1
=
dextratype
(
t
);
// empty interface pointing at this type.
// empty interface pointing at this type.
...
@@ -617,7 +626,7 @@ dcommontype(Sym *s, int ot, Type *t)
...
@@ -617,7 +626,7 @@ dcommontype(Sym *s, int ot, Type *t)
ot
=
dsymptr
(
s
,
ot
,
s1
,
0
);
// extraType
ot
=
dsymptr
(
s
,
ot
,
s1
,
0
);
// extraType
else
else
ot
=
duintptr
(
s
,
ot
,
0
);
ot
=
duintptr
(
s
,
ot
,
0
);
ot
=
d
uintptr
(
s
,
ot
,
0
);
// ptr type (placeholder for now)
ot
=
d
symptr
(
s
,
ot
,
sptr
,
0
);
// ptr to type
return
ot
;
return
ot
;
}
}
...
@@ -662,6 +671,25 @@ typename(Type *t)
...
@@ -662,6 +671,25 @@ typename(Type *t)
return
n
;
return
n
;
}
}
static
Sym
*
weaktypesym
(
Type
*
t
)
{
char
*
p
;
Sym
*
s
;
static
Pkg
*
weak
;
if
(
weak
==
nil
)
{
weak
=
mkpkg
(
strlit
(
"weak.type"
));
weak
->
name
=
"weak.type"
;
weak
->
prefix
=
"weak.type"
;
// not weak%2etype
}
p
=
smprint
(
"%#-T"
,
t
);
s
=
pkglookup
(
p
,
weak
);
free
(
p
);
return
s
;
}
static
Sym
*
static
Sym
*
dtypesym
(
Type
*
t
)
dtypesym
(
Type
*
t
)
{
{
...
...
src/cmd/ld/go.c
View file @
44fd7573
...
@@ -680,8 +680,10 @@ doweak(void)
...
@@ -680,8 +680,10 @@ doweak(void)
if
(
t
->
type
!=
0
&&
t
->
reachable
)
{
if
(
t
->
type
!=
0
&&
t
->
reachable
)
{
s
->
value
=
t
->
value
;
s
->
value
=
t
->
value
;
s
->
type
=
t
->
type
;
s
->
type
=
t
->
type
;
}
else
}
else
{
s
->
type
=
SCONST
;
s
->
value
=
0
;
s
->
value
=
0
;
}
continue
;
continue
;
}
}
}
}
...
...
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