Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Conversation

georgyangelov
Copy link
Collaborator

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); else a.StrictEquals(b)
  • expect(a).to v8_eq b <=> same as above but for Equals instead of StrictEquals

`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
- GetConstructorName
- InternalFieldCount
- GetInternalField
- SetInternalField
- HasOwnProperty
- HasRealNamedProperty
- HasRealIndexedProperty
- HasRealNamedCallbackProperty
- GetRealNamedPropertyInPrototypeChain
- GetRealNamedProperty
- GetRealNamedPropertyAttributes
- GetRealNamedPropertyAttributesInPrototypeChain
- HasNamedLookupInterceptor
- HasIndexedLookupInterceptor
- SetHiddenValue
- GetHiddenValue
- DeleteHiddenValue
- Clone
- CreationContext
- IsCallable
- CallAsFunction
- CallAsConstructor
@georgyangelov
Copy link
Collaborator Author

I think that's all of them. Should be ready for review 😃

@cowboyd
Copy link
Collaborator

cowboyd commented Aug 10, 2015

Awesome, so excited to review this!


return Enum<v8::PropertyAttribute>::Maybe(object->GetRealNamedPropertyAttributesInPrototypeChain(
Context(r_context),
*Name(key)
Copy link
Collaborator

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....

@cowboyd cowboyd merged commit 5ac3483 into rubyjs:upgrade-to-v8-4.5 Aug 10, 2015
@cowboyd
Copy link
Collaborator

cowboyd commented Aug 10, 2015

This looks really solid. I'm curious about the dereference issue, but not enough to hold it up!

@georgyangelov
Copy link
Collaborator Author

They shouldn't be needed. Don't really know what I was thinking :)

@cowboyd cowboyd deleted the 4.5/object-methods branch August 10, 2015 20:23
@cowboyd
Copy link
Collaborator

cowboyd commented Aug 10, 2015

Actually, I tried removing them, and it was getting confused between the methods that had name keys, and the integer keys, probably because of operator VALUE(). My guess is that VALUE can be constructed from an int32_t and so it doesn't know whether, for the Name object, to convert to VALUE or v8::Local<v8::Name> (just a guess)

I'm trying to tackle exception handling and v8::TryCatch and v8::StackTrace. Any chance you could look at finishing out Template, ObjectTemplate and FunctionTemplate. With those out of the way, we should have everything we need from the C api to get the entire test suite passing again.

@georgyangelov
Copy link
Collaborator Author

I will look at the templates.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants