From 75f8b28831eee2cb90b23c0caeb0afd7361b16da Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Mon, 22 May 2017 16:19:15 -0700 Subject: [PATCH] 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. --- src/js_object_accessor.hpp | 8 ++++---- src/jsc/jsc_object_accessor.hpp | 2 +- src/node/node_object_accessor.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/js_object_accessor.hpp b/src/js_object_accessor.hpp index ddda2920..fe73d83e 100644 --- a/src/js_object_accessor.hpp +++ b/src/js_object_accessor.hpp @@ -70,7 +70,7 @@ public: } template - 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(long long number) { return Value::from_number(m_ctx, number); } @@ -193,7 +193,7 @@ struct Unbox { // Need separate implementations per-engine template struct Unbox { - static BinaryData call(NativeAccessor *ctx, typename JSEngine::Value const& value, bool, bool); + static BinaryData call(NativeAccessor *ctx, typename JSEngine::Value value, bool, bool); }; template @@ -248,8 +248,8 @@ struct Unbox { template template -U NativeAccessor::unbox(ValueType const& value, bool create, bool update) { - return _impl::Unbox::call(this, value, create, update); +U NativeAccessor::unbox(ValueType value, bool create, bool update) { + return _impl::Unbox::call(this, std::move(value), create, update); } diff --git a/src/jsc/jsc_object_accessor.hpp b/src/jsc/jsc_object_accessor.hpp index 9ffa6a6d..7a02f6d6 100644 --- a/src/jsc/jsc_object_accessor.hpp +++ b/src/jsc/jsc_object_accessor.hpp @@ -29,7 +29,7 @@ namespace js { template<> template<> -inline BinaryData NativeAccessor::unbox(ValueType const& value, bool, bool) { +inline BinaryData NativeAccessor::unbox(ValueType value, bool, bool) { static jsc::String s_array_buffer = "ArrayBuffer"; static jsc::String s_buffer = "buffer"; static jsc::String s_byte_length = "byteLength"; diff --git a/src/node/node_object_accessor.hpp b/src/node/node_object_accessor.hpp index 87309457..9c338496 100644 --- a/src/node/node_object_accessor.hpp +++ b/src/node/node_object_accessor.hpp @@ -28,7 +28,7 @@ namespace js { template<> template<> -inline BinaryData NativeAccessor::unbox(ValueType const& value, bool, bool) { +inline BinaryData NativeAccessor::unbox(ValueType value, bool, bool) { if (Value::is_array_buffer(m_ctx, value)) { // TODO: This probably needs some abstraction for older V8. #if REALM_V8_ARRAY_BUFFER_API