File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
npm-packages/ruby-wasm-wasi Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ def await(promise)
79
79
current = Fiber . current
80
80
promise . call (
81
81
:then ,
82
- -> ( value ) { current . transfer ( value , :success ) } ,
83
- -> ( value ) { current . transfer ( value , :failure ) }
82
+ -> ( value ) { current . transfer ( value , :success ) ; nil } ,
83
+ -> ( value ) { current . transfer ( value , :failure ) ; nil }
84
84
)
85
85
if @loop == current
86
86
raise (
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ export class RubyVM {
210
210
procToJsFunction : ( rawRbAbiValue ) => {
211
211
const rbValue = this . rbValueOfPointer ( rawRbAbiValue ) ;
212
212
return ( ...args ) => {
213
- rbValue . call ( "call" , ...args . map ( ( arg ) => this . wrap ( arg ) ) ) ;
213
+ return rbValue . call ( "call" , ...args . map ( ( arg ) => this . wrap ( arg ) ) ) . toJS ( ) ;
214
214
} ;
215
215
} ,
216
216
rbObjectToJsRbValue : ( rawRbAbiValue ) => {
Original file line number Diff line number Diff line change @@ -26,4 +26,11 @@ def test_store_in_js
26
26
function_to_call . call ( :invoke )
27
27
assert_equal 1 , b
28
28
end
29
+
30
+ def test_return_value
31
+ obj = JS . eval ( <<~JS )
32
+ return { check: (callback) => { return callback(1) } }
33
+ JS
34
+ assert_equal 4 , obj . call ( :check , -> ( a ) { 3 + a . to_i } ) . to_i
35
+ end
29
36
end
You can’t perform that action at this time.
0 commit comments