Fix the Node build.

Tweak the signature on some of the accessor methods to take
`JSEngine::Value`s by value rather than by const reference. Some Node
APIs appear to assume that only non-const objects will be used.
This commit is contained in:
Mark Rowe 2017-05-22 16:19:15 -07:00
parent 66da78af74
commit 75f8b28831
3 changed files with 6 additions and 6 deletions

View File

@ -70,7 +70,7 @@ public:
} }
template<typename T> template<typename T>
T unbox(ValueType const& value, bool create = false, bool update = false); T unbox(ValueType value, bool create = false, bool update = false);
ValueType box(bool boolean) { return Value::from_boolean(m_ctx, boolean); } ValueType box(bool boolean) { return Value::from_boolean(m_ctx, boolean); }
ValueType box(long long number) { return Value::from_number(m_ctx, number); } ValueType box(long long number) { return Value::from_number(m_ctx, number); }
@ -193,7 +193,7 @@ struct Unbox<JSEngine, StringData> {
// Need separate implementations per-engine // Need separate implementations per-engine
template<typename JSEngine> template<typename JSEngine>
struct Unbox<JSEngine, BinaryData> { struct Unbox<JSEngine, BinaryData> {
static BinaryData call(NativeAccessor<JSEngine> *ctx, typename JSEngine::Value const& value, bool, bool); static BinaryData call(NativeAccessor<JSEngine> *ctx, typename JSEngine::Value value, bool, bool);
}; };
template<typename JSEngine> template<typename JSEngine>
@ -248,8 +248,8 @@ struct Unbox<JSEngine, RowExpr> {
template<typename T> template<typename T>
template<typename U> template<typename U>
U NativeAccessor<T>::unbox(ValueType const& value, bool create, bool update) { U NativeAccessor<T>::unbox(ValueType value, bool create, bool update) {
return _impl::Unbox<T, U>::call(this, value, create, update); return _impl::Unbox<T, U>::call(this, std::move(value), create, update);
} }

View File

@ -29,7 +29,7 @@ namespace js {
template<> template<>
template<> template<>
inline BinaryData NativeAccessor<jsc::Types>::unbox(ValueType const& value, bool, bool) { inline BinaryData NativeAccessor<jsc::Types>::unbox(ValueType value, bool, bool) {
static jsc::String s_array_buffer = "ArrayBuffer"; static jsc::String s_array_buffer = "ArrayBuffer";
static jsc::String s_buffer = "buffer"; static jsc::String s_buffer = "buffer";
static jsc::String s_byte_length = "byteLength"; static jsc::String s_byte_length = "byteLength";

View File

@ -28,7 +28,7 @@ namespace js {
template<> template<>
template<> template<>
inline BinaryData NativeAccessor<node::Types>::unbox(ValueType const& value, bool, bool) { inline BinaryData NativeAccessor<node::Types>::unbox(ValueType value, bool, bool) {
if (Value::is_array_buffer(m_ctx, value)) { if (Value::is_array_buffer(m_ctx, value)) {
// TODO: This probably needs some abstraction for older V8. // TODO: This probably needs some abstraction for older V8.
#if REALM_V8_ARRAY_BUFFER_API #if REALM_V8_ARRAY_BUFFER_API