Closed Bug 1631114 Opened 6 years ago Closed 6 years ago

Make Handle<Maybe<>> more convenient

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: evilpies, Assigned: jonco)

References

Details

Attachments

(1 file)

I am using Handle<Maybe<Value>>> in D64437 and there are some usability problems:

  • I have to do handle.get.isSome() instead of just handle.isSome().
  • I really want to just pass Nothing() to a parameter, instead of having to do
Maybe<JS::Value> nothing = Nothing();
f(Handle<Maybe<Value>>::fromMarkedLocation(&nothing));

(In this case I don't have access to a JSContext without changing a bunch of code)

Please do try to avoid Handle::fromMarkedLocation. Ideally we would remove this but it's still necessary in a few places.

Assignee: nobody → jcoppeard
Priority: -- → P1

This adds WrappedPtrOperations and MutableWrappedPtrOperations specialisations for Maybe<T> to all basic Maybe operations to used on Rooted<Maybe<T>>, Handle<Maybe<T>>, etc. I didn't add all of them; in particular I found ptr() would conflict with the Rooted::ptr data member.

This also adds JS::NothingHandleValue for passing Nothing to a Handle<Maybe<Value>>.

Blocks: 1595046
No longer depends on: 1595046
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/73d7489248b6 Make Handle<Maybe<Value>> easier to use r=jandem
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: