mirror of
https://github.com/rubyjs/therubyrhino
synced 2023-03-27 23:21:34 -04:00
fix NativeObject#[]= JS constant resolution + change getCurrentContext when converting scoped values
This commit is contained in:
parent
b59f15acbe
commit
167e089722
2 changed files with 4 additions and 4 deletions
|
@ -98,6 +98,8 @@ end
|
|||
|
||||
class Java::OrgMozillaJavascript::NativeObject
|
||||
|
||||
import "org.mozilla.javascript"
|
||||
|
||||
# re-implement Map#put
|
||||
def []=(key, value)
|
||||
scope = self
|
||||
|
|
|
@ -40,8 +40,7 @@ module Rhino
|
|||
end
|
||||
|
||||
def array_to_javascript(rb_array, scope = nil)
|
||||
if scope
|
||||
raise "no current context" unless context = JS::Context.getCurrentContext
|
||||
if scope && context = JS::Context.getCurrentContext
|
||||
context.newArray(scope, rb_array.to_java)
|
||||
else
|
||||
JS::NativeArray.new(rb_array.to_java)
|
||||
|
@ -50,8 +49,7 @@ module Rhino
|
|||
|
||||
def hash_to_javascript(rb_hash, scope = nil)
|
||||
js_object =
|
||||
if scope
|
||||
raise "no current context" unless context = JS::Context.getCurrentContext
|
||||
if scope && context = JS::Context.getCurrentContext
|
||||
context.newObject(scope)
|
||||
else
|
||||
JS::NativeObject.new
|
||||
|
|
Loading…
Reference in a new issue