Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
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
张蕾
Geth-Modification
Commits
a50b471b
Commit
a50b471b
authored
Jan 23, 2019
by
gary rong
Committed by
Guillaume Ballet
Jan 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts/abi: allow interface as the destination (#18490)
parent
ad849c01
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
reflect.go
accounts/abi/reflect.go
+1
-1
unpack_test.go
accounts/abi/unpack_test.go
+15
-0
No files found.
accounts/abi/reflect.go
View file @
a50b471b
...
...
@@ -74,7 +74,7 @@ func mustArrayToByteSlice(value reflect.Value) reflect.Value {
func
set
(
dst
,
src
reflect
.
Value
)
error
{
dstType
,
srcType
:=
dst
.
Type
(),
src
.
Type
()
switch
{
case
dstType
.
Kind
()
==
reflect
.
Interface
:
case
dstType
.
Kind
()
==
reflect
.
Interface
&&
dst
.
Elem
()
.
IsValid
()
:
return
set
(
dst
.
Elem
(),
src
)
case
dstType
.
Kind
()
==
reflect
.
Ptr
&&
dstType
.
Elem
()
!=
derefbigT
:
return
set
(
dst
.
Elem
(),
src
)
...
...
accounts/abi/unpack_test.go
View file @
a50b471b
...
...
@@ -512,6 +512,11 @@ func TestMethodMultiReturn(t *testing.T) {
Int
*
big
.
Int
}
newInterfaceSlice
:=
func
(
len
int
)
interface
{}
{
slice
:=
make
([]
interface
{},
len
)
return
&
slice
}
abi
,
data
,
expected
:=
methodMultiReturn
(
require
.
New
(
t
))
bigint
:=
new
(
big
.
Int
)
var
testCases
=
[]
struct
{
...
...
@@ -539,6 +544,16 @@ func TestMethodMultiReturn(t *testing.T) {
&
[
2
]
interface
{}{
&
expected
.
Int
,
&
expected
.
String
},
""
,
"Can unpack into an array"
,
},
{
&
[
2
]
interface
{}{},
&
[
2
]
interface
{}{
expected
.
Int
,
expected
.
String
},
""
,
"Can unpack into interface array"
,
},
{
newInterfaceSlice
(
2
),
&
[]
interface
{}{
expected
.
Int
,
expected
.
String
},
""
,
"Can unpack into interface slice"
,
},
{
&
[]
interface
{}{
new
(
int
),
new
(
int
)},
&
[]
interface
{}{
&
expected
.
Int
,
&
expected
.
String
},
...
...
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