|
@@ -1844,7 +1844,6 @@ func (r *Runtime) wrapReflectFunc(value reflect.Value) func(FunctionCall) Value
|
|
|
in = make([]reflect.Value, l)
|
|
|
}
|
|
|
|
|
|
- callSlice := false
|
|
|
for i, a := range call.Arguments {
|
|
|
var t reflect.Type
|
|
|
|
|
@@ -1861,19 +1860,6 @@ func (r *Runtime) wrapReflectFunc(value reflect.Value) func(FunctionCall) Value
|
|
|
t = typ.In(n)
|
|
|
}
|
|
|
|
|
|
- // if this is a variadic Go function, and the caller has supplied
|
|
|
- // exactly the number of JavaScript arguments required, and this
|
|
|
- // is the last JavaScript argument, try treating it as the
|
|
|
- // actual set of variadic Go arguments. if that succeeds, break
|
|
|
- // out of the loop.
|
|
|
- if typ.IsVariadic() && len(call.Arguments) == nargs && i == nargs-1 {
|
|
|
- v := reflect.New(typ.In(n)).Elem()
|
|
|
- if err := r.toReflectValue(a, v, &objectExportCtx{}); err == nil {
|
|
|
- in[i] = v
|
|
|
- callSlice = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
v := reflect.New(t).Elem()
|
|
|
err := r.toReflectValue(a, v, &objectExportCtx{})
|
|
|
if err != nil {
|
|
@@ -1882,13 +1868,7 @@ func (r *Runtime) wrapReflectFunc(value reflect.Value) func(FunctionCall) Value
|
|
|
in[i] = v
|
|
|
}
|
|
|
|
|
|
- var out []reflect.Value
|
|
|
- if callSlice {
|
|
|
- out = value.CallSlice(in)
|
|
|
- } else {
|
|
|
- out = value.Call(in)
|
|
|
- }
|
|
|
-
|
|
|
+ out := value.Call(in)
|
|
|
if len(out) == 0 {
|
|
|
return _undefined
|
|
|
}
|
|
@@ -2192,8 +2172,8 @@ func (r *Runtime) wrapJSFunc(fn Callable, typ reflect.Type) func(args []reflect.
|
|
|
//
|
|
|
// Array is treated as iterable (i.e. overwriting Symbol.iterator affects the result).
|
|
|
//
|
|
|
-// If an object has a 'length' property it is treated as array-like. The resulting slice will contain
|
|
|
-// obj[0], ... obj[length-1].
|
|
|
+// If an object has a 'length' property and is not a function it is treated as array-like. The resulting slice
|
|
|
+// will contain obj[0], ... obj[length-1].
|
|
|
//
|
|
|
// For any other Object an error is returned.
|
|
|
//
|