mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
allow default ruby access property interceptors to specify which properties they do *not* intercept.
This commit is contained in:
parent
bec7b7a13d
commit
1b5ea69f67
3 changed files with 25 additions and 12 deletions
|
@ -122,7 +122,11 @@ module V8
|
|||
To.v8(method)
|
||||
end
|
||||
elsif obj.respond_to?(:[])
|
||||
Function.rubysend(obj, :[], name)
|
||||
intercepts = true
|
||||
result = Function.rubysend(obj, :[], name) do
|
||||
intercepts = false
|
||||
end
|
||||
intercepts ? result : C::Empty
|
||||
else
|
||||
C::Empty
|
||||
end
|
||||
|
@ -140,8 +144,11 @@ module V8
|
|||
Function.rubysend(obj, setter, To.rb(value))
|
||||
value
|
||||
elsif obj.respond_to?(:[]=)
|
||||
Function.rubysend(obj, :[]=, name, To.rb(value))
|
||||
value
|
||||
intercepts = true
|
||||
Function.rubysend(obj, :[]=, name, To.rb(value)) do
|
||||
intercepts = false
|
||||
end
|
||||
intercepts ? value : C::Empty
|
||||
else
|
||||
C::Empty
|
||||
end
|
||||
|
@ -165,7 +172,11 @@ module V8
|
|||
def self.call(index, info)
|
||||
obj = To.rb(info.This())
|
||||
if obj.respond_to?(:[])
|
||||
Function.rubysend(obj, :[], index)
|
||||
intercepts = true
|
||||
value = Function.rubysend(obj, :[], index) do
|
||||
intercepts = false
|
||||
end
|
||||
intercepts ? value : C::Empty
|
||||
else
|
||||
C::Empty
|
||||
end
|
||||
|
@ -176,8 +187,11 @@ module V8
|
|||
def self.call(index, value, info)
|
||||
obj = To.rb(info.This())
|
||||
if obj.respond_to?(:[]=)
|
||||
Function.rubysend(obj, :[]=, index, To.rb(value))
|
||||
value
|
||||
intercepts = true
|
||||
Function.rubysend(obj, :[]=, index, To.rb(value)) do
|
||||
intercepts = false
|
||||
end
|
||||
intercepts ? value : C::Empty
|
||||
else
|
||||
C::Empty
|
||||
end
|
||||
|
@ -190,7 +204,6 @@ module V8
|
|||
if obj.respond_to?(:length)
|
||||
C::Array::New(obj.length).tap do |indices|
|
||||
for index in 0..obj.length - 1
|
||||
rputs "index: #{index}"
|
||||
indices.Set(index,index)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,15 +40,15 @@ module V8
|
|||
end
|
||||
end
|
||||
|
||||
def self.rubycall(rubycode, *args)
|
||||
def self.rubycall(rubycode, *args, &block)
|
||||
rubyprotect do
|
||||
rubycode.call(*args)
|
||||
rubycode.call(*args, &block)
|
||||
end
|
||||
end
|
||||
|
||||
def self.rubysend(obj, message, *args)
|
||||
def self.rubysend(obj, message, *args, &block)
|
||||
rubyprotect do
|
||||
obj.send(message, *args)
|
||||
obj.send(message, *args, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9c6563d8c3838ace05936990b11e0366db6c5564
|
||||
Subproject commit baabf41cdcc1f19ddc2cdf392b92e836989b0ad7
|
Loading…
Add table
Reference in a new issue