Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
2cb01a39
Commit
2cb01a39
authored
Oct 01, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reflect: Fix reflect.Call with function following non-pointer.
From-SVN: r203052
parent
62fecdd3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
libgo/go/reflect/all_test.go
+9
-0
libgo/go/reflect/value.go
+4
-2
No files found.
libgo/go/reflect/all_test.go
View file @
2cb01a39
...
...
@@ -2406,6 +2406,15 @@ func TestVariadic(t *testing.T) {
}
}
func
TestFuncArg
(
t
*
testing
.
T
)
{
f1
:=
func
(
i
int
,
f
func
(
int
)
int
)
int
{
return
f
(
i
)
}
f2
:=
func
(
i
int
)
int
{
return
i
+
1
}
r
:=
ValueOf
(
f1
)
.
Call
([]
Value
{
ValueOf
(
100
),
ValueOf
(
f2
)})
if
r
[
0
]
.
Int
()
!=
101
{
t
.
Errorf
(
"function returned %d, want 101"
,
r
[
0
]
.
Int
())
}
}
var
tagGetTests
=
[]
struct
{
Tag
StructTag
Key
string
...
...
libgo/go/reflect/value.go
View file @
2cb01a39
...
...
@@ -433,7 +433,7 @@ func (v Value) call(op string, in []Value) []Value {
if
v
.
flag
&
flagMethod
!=
0
{
nin
++
}
firstPointer
:=
len
(
in
)
>
0
&&
Kind
(
t
.
In
(
0
)
.
(
*
rtype
)
.
kind
)
!=
Ptr
&&
v
.
flag
&
flagMethod
==
0
&&
isMethod
(
v
.
typ
)
firstPointer
:=
len
(
in
)
>
0
&&
t
.
In
(
0
)
.
Kind
(
)
!=
Ptr
&&
v
.
flag
&
flagMethod
==
0
&&
isMethod
(
v
.
typ
)
params
:=
make
([]
unsafe
.
Pointer
,
nin
)
off
:=
0
if
v
.
flag
&
flagMethod
!=
0
{
...
...
@@ -497,8 +497,10 @@ func isMethod(t *rtype) bool {
sawRet
:=
false
for
i
,
c
:=
range
s
{
if
c
==
'('
{
if
parens
==
0
{
params
++
}
parens
++
params
++
}
else
if
c
==
')'
{
parens
--
}
else
if
parens
==
0
&&
c
==
' '
&&
s
[
i
+
1
]
!=
'('
&&
!
sawRet
{
...
...
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