diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-04-26 09:55:32 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-04-26 09:55:32 +0200 |
| commit | 7b15ed9ef455b6b66c6b376898a88aef5d6a9970 (patch) | |
| tree | 3ef530baa80cdf29436ba981f5783be6b4d2202b /src/pkg/try/try.go | |
| parent | 50104cc32a498f7517a51c8dc93106c51c7a54b4 (diff) | |
| download | golang-7b15ed9ef455b6b66c6b376898a88aef5d6a9970.tar.gz | |
Imported Upstream version 2011.04.13upstream/2011.04.13
Diffstat (limited to 'src/pkg/try/try.go')
| -rw-r--r-- | src/pkg/try/try.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/try/try.go b/src/pkg/try/try.go index af31d0d2c..1171c80c2 100644 --- a/src/pkg/try/try.go +++ b/src/pkg/try/try.go @@ -90,13 +90,13 @@ func tryMethod(pkg, firstArg string, method reflect.Method, args []interface{}) // tryFunction sees if fn satisfies the arguments. func tryFunction(pkg, name string, fn interface{}, args []interface{}) { defer func() { recover() }() - rfn := reflect.NewValue(fn).(*reflect.FuncValue) - typ := rfn.Type().(*reflect.FuncType) + rfn := reflect.NewValue(fn) + typ := rfn.Type() tryOneFunction(pkg, "", name, typ, rfn, args) } // tryOneFunction is the common code for tryMethod and tryFunction. -func tryOneFunction(pkg, firstArg, name string, typ *reflect.FuncType, rfn *reflect.FuncValue, args []interface{}) { +func tryOneFunction(pkg, firstArg, name string, typ reflect.Type, rfn reflect.Value, args []interface{}) { // Any results? if typ.NumOut() == 0 { return // Nothing to do. @@ -166,7 +166,7 @@ func compatible(arg interface{}, typ reflect.Type) bool { } if arg == nil { // nil is OK if the type is an interface. - if _, ok := typ.(*reflect.InterfaceType); ok { + if typ.Kind() == reflect.Interface { return true } } |
