Skip to content

Commit

Permalink
Overload makeHandle<T> for PseudoHandle<HermesValue>.
Browse files Browse the repository at this point in the history
Summary:
This will allow `runtime->makeHandle<T>(std::move(pseudoHandle))`
by `vmcast`ing the `pseudoHandle` to `T`.

Reviewed By: tmikov

Differential Revision: D19746824

fbshipit-source-id: 176217f34ef52a15325cee577b73750b98d2c4cc
  • Loading branch information
avp authored and facebook-github-bot committed May 7, 2020
1 parent 6f5bcfd commit ca1a3fc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/hermes/VM/HandleRootOwner.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ class HandleRootOwner {
return res;
}

/// Create a Handle from a valid PseudoHandle by vmcasting from HermesValue
/// and invalidate the PseudoHandle<HermesValue>.
template <class T>
Handle<T> makeHandle(PseudoHandle<HermesValue> &&pseudo) {
Handle<T> res{this, PseudoHandle<T>::vmcast(std::move(pseudo)).get()};
return res;
}

/// Convenience function to create a MutableHandle.
MutableHandle<HermesValue> makeMutableHandle(HermesValue value);
/// Convenience function to create a MutableHandle from a pointer.
Expand Down

0 comments on commit ca1a3fc

Please sign in to comment.