@@ -110,11 +110,9 @@ export class SwiftRuntime {
110110 payload2 : number
111111 ) => {
112112 const obj = this . memory . getObject ( ref ) ;
113- Reflect . set (
114- obj ,
115- this . memory . getObject ( name ) ,
116- JSValue . decode ( kind , payload1 , payload2 , this . memory )
117- ) ;
113+ const key = this . memory . getObject ( name ) ;
114+ const value = JSValue . decode ( kind , payload1 , payload2 , this . memory ) ;
115+ obj [ key ] = value ;
118116 } ,
119117
120118 swjs_get_prop : (
@@ -125,7 +123,8 @@ export class SwiftRuntime {
125123 payload2_ptr : pointer
126124 ) => {
127125 const obj = this . memory . getObject ( ref ) ;
128- const result = Reflect . get ( obj , this . memory . getObject ( name ) ) ;
126+ const key = this . memory . getObject ( name ) ;
127+ const result = obj [ key ] ;
129128 JSValue . write (
130129 result ,
131130 kind_ptr ,
@@ -144,11 +143,8 @@ export class SwiftRuntime {
144143 payload2 : number
145144 ) => {
146145 const obj = this . memory . getObject ( ref ) ;
147- Reflect . set (
148- obj ,
149- index ,
150- JSValue . decode ( kind , payload1 , payload2 , this . memory )
151- ) ;
146+ const value = JSValue . decode ( kind , payload1 , payload2 , this . memory ) ;
147+ obj [ index ] = value ;
152148 } ,
153149
154150 swjs_get_subscript : (
@@ -159,7 +155,7 @@ export class SwiftRuntime {
159155 payload2_ptr : pointer
160156 ) => {
161157 const obj = this . memory . getObject ( ref ) ;
162- const result = Reflect . get ( obj , index ) ;
158+ const result = obj [ index ] ;
163159 JSValue . write (
164160 result ,
165161 kind_ptr ,
@@ -201,11 +197,8 @@ export class SwiftRuntime {
201197 const func = this . memory . getObject ( ref ) ;
202198 let result : any ;
203199 try {
204- result = Reflect . apply (
205- func ,
206- undefined ,
207- JSValue . decodeArray ( argv , argc , this . memory )
208- ) ;
200+ const args = JSValue . decodeArray ( argv , argc , this . memory ) ;
201+ result = func ( ...args ) ;
209202 } catch ( error ) {
210203 JSValue . write (
211204 error ,
@@ -237,11 +230,8 @@ export class SwiftRuntime {
237230 const func = this . memory . getObject ( ref ) ;
238231 let isException = true ;
239232 try {
240- const result = Reflect . apply (
241- func ,
242- undefined ,
243- JSValue . decodeArray ( argv , argc , this . memory )
244- ) ;
233+ const args = JSValue . decodeArray ( argv , argc , this . memory ) ;
234+ const result = func ( ...args ) ;
245235 JSValue . write (
246236 result ,
247237 kind_ptr ,
@@ -278,11 +268,8 @@ export class SwiftRuntime {
278268 const func = this . memory . getObject ( func_ref ) ;
279269 let result : any ;
280270 try {
281- result = Reflect . apply (
282- func ,
283- obj ,
284- JSValue . decodeArray ( argv , argc , this . memory )
285- ) ;
271+ const args = JSValue . decodeArray ( argv , argc , this . memory ) ;
272+ result = func . apply ( obj , args ) ;
286273 } catch ( error ) {
287274 JSValue . write (
288275 error ,
@@ -317,11 +304,8 @@ export class SwiftRuntime {
317304 const func = this . memory . getObject ( func_ref ) ;
318305 let isException = true ;
319306 try {
320- const result = Reflect . apply (
321- func ,
322- obj ,
323- JSValue . decodeArray ( argv , argc , this . memory )
324- ) ;
307+ const args = JSValue . decodeArray ( argv , argc , this . memory ) ;
308+ const result = func . apply ( obj , args ) ;
325309 JSValue . write (
326310 result ,
327311 kind_ptr ,
@@ -346,10 +330,8 @@ export class SwiftRuntime {
346330 } ,
347331 swjs_call_new : ( ref : ref , argv : pointer , argc : number ) => {
348332 const constructor = this . memory . getObject ( ref ) ;
349- const instance = Reflect . construct (
350- constructor ,
351- JSValue . decodeArray ( argv , argc , this . memory )
352- ) ;
333+ const args = JSValue . decodeArray ( argv , argc , this . memory ) ;
334+ const instance = new constructor ( ...args ) ;
353335 return this . memory . retain ( instance ) ;
354336 } ,
355337
@@ -364,10 +346,8 @@ export class SwiftRuntime {
364346 const constructor = this . memory . getObject ( ref ) ;
365347 let result : any ;
366348 try {
367- result = Reflect . construct (
368- constructor ,
369- JSValue . decodeArray ( argv , argc , this . memory )
370- ) ;
349+ const args = JSValue . decodeArray ( argv , argc , this . memory ) ;
350+ result = new constructor ( ...args ) ;
371351 } catch ( error ) {
372352 JSValue . write (
373353 error ,
0 commit comments