mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/abi: removed unnused code
This commit is contained in:
parent
16fff08049
commit
9e52c261e1
1 changed files with 10 additions and 48 deletions
|
|
@ -32,14 +32,6 @@ func indirect(v reflect.Value) reflect.Value {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// indirectInterfaceOrPtr recursively dereferences the value until value is not interface.
|
|
||||||
func indirectInterfaceOrPtr(v reflect.Value) reflect.Value {
|
|
||||||
if (v.Kind() == reflect.Interface || v.Kind() == reflect.Ptr) && v.Elem().IsValid() {
|
|
||||||
return indirect(v.Elem())
|
|
||||||
}
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// reflectIntType returns the reflect using the given size and
|
// reflectIntType returns the reflect using the given size and
|
||||||
// unsignedness.
|
// unsignedness.
|
||||||
func reflectIntType(unsigned bool, size int) reflect.Type {
|
func reflectIntType(unsigned bool, size int) reflect.Type {
|
||||||
|
|
@ -106,8 +98,6 @@ func set(dst, src reflect.Value) error {
|
||||||
// setSlice ignores if we cannot copy all of src' elements.
|
// setSlice ignores if we cannot copy all of src' elements.
|
||||||
func setSlice(dst, src reflect.Value) error {
|
func setSlice(dst, src reflect.Value) error {
|
||||||
slice := reflect.MakeSlice(dst.Type(), src.Len(), src.Len())
|
slice := reflect.MakeSlice(dst.Type(), src.Len(), src.Len())
|
||||||
if src.Type() != dst.Type() {
|
|
||||||
fmt.Printf(" %v %v ", src.Type(), dst.Type())
|
|
||||||
for i := 0; i < src.Len(); i++ {
|
for i := 0; i < src.Len(); i++ {
|
||||||
if src.Index(i).Kind() == reflect.Struct {
|
if src.Index(i).Kind() == reflect.Struct {
|
||||||
if err := set(slice.Index(i), src.Index(i)); err != nil {
|
if err := set(slice.Index(i), src.Index(i)); err != nil {
|
||||||
|
|
@ -121,11 +111,6 @@ func setSlice(dst, src reflect.Value) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for i := 0; i < src.Len(); i++ {
|
|
||||||
reflect.Copy(slice.Index(i), src.Index(i))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dst.Set(slice)
|
dst.Set(slice)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -156,29 +141,6 @@ func setStruct(dst, src reflect.Value) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// requireAssignable assures that `dest` is a pointer and it's not an interface.
|
|
||||||
func requireAssignable(dst, src reflect.Value) error {
|
|
||||||
if dst.Kind() != reflect.Ptr && dst.Kind() != reflect.Interface {
|
|
||||||
return fmt.Errorf("abi: cannot unmarshal %v into %v", src.Type(), dst.Type())
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// requireUnpackKind verifies preconditions for unpacking `args` into `kind`
|
|
||||||
func requireUnpackKind(v reflect.Value, minLength int, args Arguments) error {
|
|
||||||
switch v.Kind() {
|
|
||||||
case reflect.Struct:
|
|
||||||
case reflect.Slice, reflect.Array:
|
|
||||||
if v.Len() < minLength {
|
|
||||||
return fmt.Errorf("abi: insufficient number of elements in the list/array for unpack, want %d, got %d",
|
|
||||||
minLength, v.Len())
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("abi: cannot unmarshal tuple into %v", v.Type())
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// mapArgNamesToStructFields maps a slice of argument names to struct fields.
|
// mapArgNamesToStructFields maps a slice of argument names to struct fields.
|
||||||
// first round: for each Exportable field that contains a `abi:""` tag
|
// first round: for each Exportable field that contains a `abi:""` tag
|
||||||
// and this field name exists in the given argument name list, pair them together.
|
// and this field name exists in the given argument name list, pair them together.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue