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
|
class Java::OrgMozillaJavascript::NativeObject
|
||||||
|
|
||||||
|
import "org.mozilla.javascript"
|
||||||
|
|
||||||
# re-implement Map#put
|
# re-implement Map#put
|
||||||
def []=(key, value)
|
def []=(key, value)
|
||||||
scope = self
|
scope = self
|
||||||
|
|
|
@ -40,8 +40,7 @@ module Rhino
|
||||||
end
|
end
|
||||||
|
|
||||||
def array_to_javascript(rb_array, scope = nil)
|
def array_to_javascript(rb_array, scope = nil)
|
||||||
if scope
|
if scope && context = JS::Context.getCurrentContext
|
||||||
raise "no current context" unless context = JS::Context.getCurrentContext
|
|
||||||
context.newArray(scope, rb_array.to_java)
|
context.newArray(scope, rb_array.to_java)
|
||||||
else
|
else
|
||||||
JS::NativeArray.new(rb_array.to_java)
|
JS::NativeArray.new(rb_array.to_java)
|
||||||
|
@ -50,8 +49,7 @@ module Rhino
|
||||||
|
|
||||||
def hash_to_javascript(rb_hash, scope = nil)
|
def hash_to_javascript(rb_hash, scope = nil)
|
||||||
js_object =
|
js_object =
|
||||||
if scope
|
if scope && context = JS::Context.getCurrentContext
|
||||||
raise "no current context" unless context = JS::Context.getCurrentContext
|
|
||||||
context.newObject(scope)
|
context.newObject(scope)
|
||||||
else
|
else
|
||||||
JS::NativeObject.new
|
JS::NativeObject.new
|
||||||
|
|
Loading…
Reference in a new issue