From d199a7097935842dc1f165724ac7f9b5e49291d0 Mon Sep 17 00:00:00 2001 From: Tim Pettersen Date: Wed, 13 Sep 2017 16:05:22 +1000 Subject: [PATCH] Replace spread operator with eval() to allow safe transpilation to ES5 --- src/runtime.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runtime.js b/src/runtime.js index d3eeff4..072c304 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -1,10 +1,13 @@ // You can store this to call your function. this must be bound to the current instance. export function SuperCall(selector, argTypes, returnType) { const func = CFunc("objc_msgSendSuper", [{type: '^' + objc_super_typeEncoding}, {type: ":"}, ...argTypes], returnType); - return function(...args) { + return function() { const struct = make_objc_super(this, this.superclass()); const structPtr = MOPointer.alloc().initWithValue_(struct); - return func(structPtr, selector, ...args); + const params = ['structPtr', 'selector'].concat( + [].slice.apply(arguments).map((val, i) => `arguments[${i}]`) + ) + return eval(`func(${params.join(', ')})`) }; }