1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

named property query.

This commit is contained in:
Charles Lowell 2010-08-06 12:10:20 -05:00
parent 6f235622f2
commit 3050e77046

View file

@ -162,6 +162,52 @@ module V8
end
end
class NamedPropertyQuery
extend AccessibleMethods
class Attrs
def initialize
@flags = 0
end
def read_only
tap do
@flags |= V8::C::ReadOnly
end
end
def dont_enum
tap do
@flags |= V8::C::DontEnum
end
end
def dont_delete
tap do
@flags |= V8::C::DontDelete
end
end
end
def self.call(property, info)
attrs = Attrs.new
intercepts = true
access_query(To.rb(info.This()), To.rb(property), attrs) do
intercepts = false
end
intercepts ? C::Integer::New(attrs.flags) : C::Empty
end
def self.access_attributes(obj, name, attrs)
unless obj.respond_to?(name)
attrs.dont_enum
attrs.dont_delete
end
unless obj.respond_to?("name=")
attrs.read_only
end
end
end
class NamedPropertyEnumerator
extend AccessibleMethods
def self.call(info)