-
Notifications
You must be signed in to change notification settings - Fork 193
Implement Object API #377
Implement Object API #377
Conversation
`expect(a).to eq_just b` <=> `a.IsJust && a.FromJust == b` `expect(a).to be_successful` <=> `a.IsJust && a.FromJust` `expect(a).to strict_eq b` <=> if a is Maybe: `a.IsJust && a.FromJust.StrictEquals(b)`; else `a.StrictEquals(b)` `expect(a).to v8_eq b` <=> same as above but for `Equals` instead of `StrictEquals`
One of the tests is commented out until SetAccessorProperty is implemented
e1421d2
to
1cfbe81
Compare
- GetConstructorName - InternalFieldCount - GetInternalField - SetInternalField - HasOwnProperty - HasRealNamedProperty - HasRealIndexedProperty - HasRealNamedCallbackProperty - GetRealNamedPropertyInPrototypeChain - GetRealNamedProperty - GetRealNamedPropertyAttributes - GetRealNamedPropertyAttributesInPrototypeChain - HasNamedLookupInterceptor - HasIndexedLookupInterceptor - SetHiddenValue - GetHiddenValue - DeleteHiddenValue - Clone - CreationContext - IsCallable - CallAsFunction - CallAsConstructor
I think that's all of them. Should be ready for review 😃 |
Awesome, so excited to review this! |
|
||
return Enum<v8::PropertyAttribute>::Maybe(object->GetRealNamedPropertyAttributesInPrototypeChain( | ||
Context(r_context), | ||
*Name(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing a bunch of cases where you have to dereference explicitly. Shouldn't this conversion handle it? https://github.com/cowboyd/therubyracer/blob/upgrade-to-v8-4.5/ext/v8/ref.h#L70-L72
If not, perhaps the typedef of v8::Handle
to v8::Local
is confusing it? maybe if we change that to a v8::Local
from v8::Handle
....
This looks really solid. I'm curious about the dereference issue, but not enough to hold it up! |
They shouldn't be needed. Don't really know what I was thinking :) |
Actually, I tried removing them, and it was getting confused between the methods that had name keys, and the integer keys, probably because of I'm trying to tackle exception handling and |
I will look at the templates. |
In this branch I put the Object method implementations.
Currently implemented:
SetAccessorProperty
GetOwnPropertyAccessor
GetPropertyAttributes
DefineOwnProperty
CreateDataProperty
GetConstructorName
InternalFieldCount
GetInternalField
SetInternalField
HasOwnProperty
HasRealNamedProperty
HasRealIndexedProperty
HasRealNamedCallbackProperty
GetRealNamedPropertyInPrototypeChain
GetRealNamedProperty
GetRealNamedPropertyAttributes
GetRealNamedPropertyAttributesInPrototypeChain
HasNamedLookupInterceptor
HasIndexedLookupInterceptor
SetHiddenValue
GetHiddenValue
DeleteHiddenValue
Clone
CreationContext
IsCallable
CallAsFunction
CallAsConstructor
Also, I added a few RSpec matchers for a more convenient use of
Maybe
instances:expect(a).to eq_just b
<=>a.IsJust && a.FromJust == b
expect(a).to be_successful
<=>a.IsJust && a.FromJust
expect(a).to strict_eq b
<=> if a is Maybe:a.IsJust && a.FromJust.StrictEquals(b)
; elsea.StrictEquals(b)
expect(a).to v8_eq b
<=> same as above but forEquals
instead ofStrictEquals