diff --git a/napi-inl.h b/napi-inl.h index 471b25ecc..a1d67ac17 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -1305,7 +1305,6 @@ inline Object::PropertyLValue Object::operator [](uint32_t index) { return PropertyLValue(*this, index); } -<<<<<<< HEAD inline MaybeOrValue Object::operator[](const char* utf8name) const { return Get(utf8name); } @@ -1316,17 +1315,6 @@ inline MaybeOrValue Object::operator[]( } inline MaybeOrValue Object::operator[](uint32_t index) const { -======= -inline Value Object::operator[](const char* utf8name) const { - return Get(utf8name); -} - -inline Value Object::operator[](const std::string& utf8name) const { - return Get(utf8name); -} - -inline Value Object::operator[](uint32_t index) const { ->>>>>>> 637e422... run tests with options to prefix build root path return Get(index); } @@ -2196,20 +2184,12 @@ inline Function::Function() : Object() { inline Function::Function(napi_env env, napi_value value) : Object(env, value) { } -<<<<<<< HEAD inline MaybeOrValue Function::operator()( -======= -inline Value Function::operator()( ->>>>>>> 637e422... run tests with options to prefix build root path const std::initializer_list& args) const { return Call(Env().Undefined(), args); } -<<<<<<< HEAD inline MaybeOrValue Function::Call( -======= -inline Value Function::Call( ->>>>>>> 637e422... run tests with options to prefix build root path const std::initializer_list& args) const { return Call(Env().Undefined(), args); } @@ -2224,16 +2204,11 @@ inline MaybeOrValue Function::Call(size_t argc, return Call(Env().Undefined(), argc, args); } -<<<<<<< HEAD inline MaybeOrValue Function::Call( -======= -inline Value Function::Call( ->>>>>>> 637e422... run tests with options to prefix build root path napi_value recv, const std::initializer_list& args) const { return Call(recv, args.size(), args.begin()); } -<<<<<<< HEAD inline MaybeOrValue Function::Call( napi_value recv, const std::vector& args) const { return Call(recv, args.size(), args.data()); @@ -2242,16 +2217,6 @@ inline MaybeOrValue Function::Call( inline MaybeOrValue Function::Call(napi_value recv, size_t argc, const napi_value* args) const { -======= -inline Value Function::Call(napi_value recv, - const std::vector& args) const { - return Call(recv, args.size(), args.data()); -} - -inline Value Function::Call(napi_value recv, - size_t argc, - const napi_value* args) const { ->>>>>>> 637e422... run tests with options to prefix build root path napi_value result; napi_status status = napi_call_function( _env, recv, _value, argc, args, &result); @@ -2266,7 +2231,6 @@ inline MaybeOrValue Function::MakeCallback( return MakeCallback(recv, args.size(), args.begin(), context); } -<<<<<<< HEAD inline MaybeOrValue Function::MakeCallback( napi_value recv, const std::vector& args, @@ -2279,18 +2243,6 @@ inline MaybeOrValue Function::MakeCallback( size_t argc, const napi_value* args, napi_async_context context) const { -======= -inline Value Function::MakeCallback(napi_value recv, - const std::vector& args, - napi_async_context context) const { - return MakeCallback(recv, args.size(), args.data(), context); -} - -inline Value Function::MakeCallback(napi_value recv, - size_t argc, - const napi_value* args, - napi_async_context context) const { ->>>>>>> 637e422... run tests with options to prefix build root path napi_value result; napi_status status = napi_make_callback( _env, context, recv, _value, argc, args, &result); @@ -2298,11 +2250,7 @@ inline Value Function::MakeCallback(napi_value recv, _env, status, Napi::Value(_env, result), Napi::Value); } -<<<<<<< HEAD inline MaybeOrValue Function::New( -======= -inline Object Function::New( ->>>>>>> 637e422... run tests with options to prefix build root path const std::initializer_list& args) const { return New(args.size(), args.begin()); } @@ -3088,11 +3036,7 @@ inline FunctionReference& FunctionReference::operator =(FunctionReference&& othe return *this; } -<<<<<<< HEAD inline MaybeOrValue FunctionReference::operator()( -======= -inline Napi::Value FunctionReference::operator()( ->>>>>>> 637e422... run tests with options to prefix build root path const std::initializer_list& args) const { EscapableHandleScope scope(_env); MaybeOrValue result = Value()(args); @@ -3109,11 +3053,7 @@ inline Napi::Value FunctionReference::operator()( #endif } -<<<<<<< HEAD inline MaybeOrValue FunctionReference::Call( -======= -inline Napi::Value FunctionReference::Call( ->>>>>>> 637e422... run tests with options to prefix build root path const std::initializer_list& args) const { EscapableHandleScope scope(_env); MaybeOrValue result = Value().Call(args); @@ -3130,11 +3070,7 @@ inline Napi::Value FunctionReference::Call( #endif } -<<<<<<< HEAD inline MaybeOrValue FunctionReference::Call( -======= -inline Napi::Value FunctionReference::Call( ->>>>>>> 637e422... run tests with options to prefix build root path const std::vector& args) const { EscapableHandleScope scope(_env); MaybeOrValue result = Value().Call(args); @@ -3185,14 +3121,8 @@ inline MaybeOrValue FunctionReference::Call( #endif } -<<<<<<< HEAD inline MaybeOrValue FunctionReference::Call( napi_value recv, size_t argc, const napi_value* args) const { -======= -inline Napi::Value FunctionReference::Call(napi_value recv, - size_t argc, - const napi_value* args) const { ->>>>>>> 637e422... run tests with options to prefix build root path EscapableHandleScope scope(_env); MaybeOrValue result = Value().Call(recv, argc, args); #ifdef NODE_ADDON_API_ENABLE_MAYBE @@ -3268,11 +3198,7 @@ inline MaybeOrValue FunctionReference::MakeCallback( #endif } -<<<<<<< HEAD inline MaybeOrValue FunctionReference::New( -======= -inline Object FunctionReference::New( ->>>>>>> 637e422... run tests with options to prefix build root path const std::initializer_list& args) const { EscapableHandleScope scope(_env); MaybeOrValue result = Value().New(args); @@ -3289,11 +3215,7 @@ inline Object FunctionReference::New( #endif } -<<<<<<< HEAD inline MaybeOrValue FunctionReference::New( -======= -inline Object FunctionReference::New( ->>>>>>> 637e422... run tests with options to prefix build root path const std::vector& args) const { EscapableHandleScope scope(_env); MaybeOrValue result = Value().New(args); diff --git a/napi.h b/napi.h index c98ccbd3e..8475bfc96 100644 --- a/napi.h +++ b/napi.h @@ -121,15 +121,9 @@ static_assert(sizeof(char16_t) == sizeof(wchar_t), "Size mismatch between char16 NAPI_DISALLOW_ASSIGN(CLASS) \ NAPI_DISALLOW_COPY(CLASS) -<<<<<<< HEAD #define NAPI_CHECK(condition, location, message) \ do { \ if (!(condition)) { \ -======= -#define NAPI_FATAL_IF_FAILED(status, location, message) \ - do { \ - if ((status) != napi_ok) { \ ->>>>>>> 637e422... run tests with options to prefix build root path Napi::Error::Fatal((location), (message)); \ } \ } while (0) @@ -278,10 +272,6 @@ namespace Napi { class CleanupHook; #endif // NAPI_VERSION > 2 #if NAPI_VERSION > 5 -<<<<<<< HEAD -======= - private: ->>>>>>> 637e422... run tests with options to prefix build root path template static void DefaultFini(Env, T* data); template static void DefaultFiniWithHint(Env, DataType* data, HintType* hint); @@ -441,7 +431,6 @@ namespace Napi { /// value type will throw `Napi::Error`. template T As() const; -<<<<<<< HEAD MaybeOrValue ToBoolean() const; ///< Coerces a value to a JavaScript boolean. MaybeOrValue ToNumber() @@ -450,12 +439,6 @@ namespace Napi { const; ///< Coerces a value to a JavaScript string. MaybeOrValue ToObject() const; ///< Coerces a value to a JavaScript object. -======= - Boolean ToBoolean() const; ///< Coerces a value to a JavaScript boolean. - Number ToNumber() const; ///< Coerces a value to a JavaScript number. - String ToString() const; ///< Coerces a value to a JavaScript string. - Object ToObject() const; ///< Coerces a value to a JavaScript object. ->>>>>>> 637e422... run tests with options to prefix build root path protected: /// !cond INTERNAL @@ -702,15 +685,12 @@ namespace Napi { public: /// Enables property and element assignments using indexing syntax. /// -<<<<<<< HEAD /// This is a convenient helper to get and set object properties. As /// getting and setting object properties may throw with JavaScript /// exceptions, it is notable that these operations may fail. /// When NODE_ADDON_API_ENABLE_MAYBE is defined, the process will abort /// on JavaScript exceptions. /// -======= ->>>>>>> 637e422... run tests with options to prefix build root path /// Example: /// /// Napi::Value propertyValue = object1['A']; @@ -762,25 +742,16 @@ namespace Napi { ); /// Gets a named property. -<<<<<<< HEAD MaybeOrValue operator[]( -======= - Value operator[]( ->>>>>>> 637e422... run tests with options to prefix build root path const char* utf8name ///< UTF-8 encoded null-terminated property name ) const; /// Gets a named property. -<<<<<<< HEAD MaybeOrValue operator[]( -======= - Value operator[]( ->>>>>>> 637e422... run tests with options to prefix build root path const std::string& utf8name ///< UTF-8 encoded property name ) const; /// Gets an indexed property or array element. -<<<<<<< HEAD MaybeOrValue operator[](uint32_t index ///< Property / element index ) const; @@ -794,26 +765,10 @@ namespace Napi { /// Checks whether a named property is present. MaybeOrValue Has( -======= - Value operator[](uint32_t index ///< Property / element index - ) const; - - /// Checks whether a property is present. - bool Has(napi_value key ///< Property key primitive - ) const; - - /// Checks whether a property is present. - bool Has(Value key ///< Property key - ) const; - - /// Checks whether a named property is present. - bool Has( ->>>>>>> 637e422... run tests with options to prefix build root path const char* utf8name ///< UTF-8 encoded null-terminated property name ) const; /// Checks whether a named property is present. -<<<<<<< HEAD MaybeOrValue Has( const std::string& utf8name ///< UTF-8 encoded property name ) const; @@ -829,35 +784,15 @@ namespace Napi { /// Checks whether a own property is present. MaybeOrValue HasOwnProperty( -======= - bool Has(const std::string& utf8name ///< UTF-8 encoded property name - ) const; - - /// Checks whether a own property is present. - bool HasOwnProperty(napi_value key ///< Property key primitive - ) const; - - /// Checks whether a own property is present. - bool HasOwnProperty(Value key ///< Property key - ) const; - - /// Checks whether a own property is present. - bool HasOwnProperty( ->>>>>>> 637e422... run tests with options to prefix build root path const char* utf8name ///< UTF-8 encoded null-terminated property name ) const; /// Checks whether a own property is present. -<<<<<<< HEAD MaybeOrValue HasOwnProperty( -======= - bool HasOwnProperty( ->>>>>>> 637e422... run tests with options to prefix build root path const std::string& utf8name ///< UTF-8 encoded property name ) const; /// Gets a property. -<<<<<<< HEAD MaybeOrValue Get(napi_value key ///< Property key primitive ) const; @@ -867,27 +802,12 @@ namespace Napi { /// Gets a named property. MaybeOrValue Get( -======= - Value Get(napi_value key ///< Property key primitive - ) const; - - /// Gets a property. - Value Get(Value key ///< Property key - ) const; - - /// Gets a named property. - Value Get( ->>>>>>> 637e422... run tests with options to prefix build root path const char* utf8name ///< UTF-8 encoded null-terminated property name ) const; /// Gets a named property. -<<<<<<< HEAD MaybeOrValue Get( const std::string& utf8name ///< UTF-8 encoded property name -======= - Value Get(const std::string& utf8name ///< UTF-8 encoded property name ->>>>>>> 637e422... run tests with options to prefix build root path ) const; /// Sets a property. @@ -916,7 +836,6 @@ namespace Napi { ); /// Delete property. -<<<<<<< HEAD MaybeOrValue Delete(napi_value key ///< Property key primitive ); @@ -926,22 +845,10 @@ namespace Napi { /// Delete property. MaybeOrValue Delete( -======= - bool Delete(napi_value key ///< Property key primitive - ); - - /// Delete property. - bool Delete(Value key ///< Property key - ); - - /// Delete property. - bool Delete( ->>>>>>> 637e422... run tests with options to prefix build root path const char* utf8name ///< UTF-8 encoded null-terminated property name ); /// Delete property. -<<<<<<< HEAD MaybeOrValue Delete( const std::string& utf8name ///< UTF-8 encoded property name ); @@ -952,17 +859,6 @@ namespace Napi { /// Gets an indexed property or array element. MaybeOrValue Get(uint32_t index ///< Property / element index -======= - bool Delete(const std::string& utf8name ///< UTF-8 encoded property name - ); - - /// Checks whether an indexed property is present. - bool Has(uint32_t index ///< Property / element index - ) const; - - /// Gets an indexed property or array element. - Value Get(uint32_t index ///< Property / element index ->>>>>>> 637e422... run tests with options to prefix build root path ) const; /// Sets an indexed property or array element. @@ -972,7 +868,6 @@ namespace Napi { ); /// Deletes an indexed property or array element. -<<<<<<< HEAD MaybeOrValue Delete(uint32_t index ///< Property / element index ); @@ -983,12 +878,6 @@ namespace Napi { /// - /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p MaybeOrValue GetPropertyNames() const; ///< Get all property names -======= - bool Delete(uint32_t index ///< Property / element index - ); - - Array GetPropertyNames() const; ///< Get all property names ->>>>>>> 637e422... run tests with options to prefix build root path /// Defines a property on the object. /// @@ -1023,7 +912,6 @@ namespace Napi { /// Checks if an object is an instance created by a constructor function. /// /// This is equivalent to the JavaScript `instanceof` operator. -<<<<<<< HEAD /// /// This operation can fail in case of Proxy.[[GetPrototypeOf]] calling into /// JavaScript. @@ -1031,9 +919,6 @@ namespace Napi { /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof MaybeOrValue InstanceOf( const Function& constructor ///< Constructor function -======= - bool InstanceOf(const Function& constructor ///< Constructor function ->>>>>>> 637e422... run tests with options to prefix build root path ) const; template @@ -1578,7 +1463,6 @@ namespace Napi { FunctionReference& operator =(FunctionReference&& other); NAPI_DISALLOW_ASSIGN_COPY(FunctionReference) -<<<<<<< HEAD MaybeOrValue operator()( const std::initializer_list& args) const; @@ -1610,33 +1494,6 @@ namespace Napi { MaybeOrValue New( const std::initializer_list& args) const; MaybeOrValue New(const std::vector& args) const; -======= - Napi::Value operator()(const std::initializer_list& args) const; - - Napi::Value Call(const std::initializer_list& args) const; - Napi::Value Call(const std::vector& args) const; - Napi::Value Call(napi_value recv, - const std::initializer_list& args) const; - Napi::Value Call(napi_value recv, - const std::vector& args) const; - Napi::Value Call(napi_value recv, - size_t argc, - const napi_value* args) const; - - Napi::Value MakeCallback(napi_value recv, - const std::initializer_list& args, - napi_async_context context = nullptr) const; - Napi::Value MakeCallback(napi_value recv, - const std::vector& args, - napi_async_context context = nullptr) const; - Napi::Value MakeCallback(napi_value recv, - size_t argc, - const napi_value* args, - napi_async_context context = nullptr) const; - - Object New(const std::initializer_list& args) const; - Object New(const std::vector& args) const; ->>>>>>> 637e422... run tests with options to prefix build root path }; // Shortcuts to creating a new reference with inferred type and refcount = 0. diff --git a/test/common/index.js b/test/common/index.js index 7c4fc5d45..110979917 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -82,6 +82,7 @@ exports.runTest = async function(test, buildType, buildPathRoot = process.env.RE const bindings = [ path.join(buildPathRoot, `../build/${buildType}/binding.node`), path.join(buildPathRoot, `../build/${buildType}/binding_noexcept.node`), + path.join(buildPathRoot, `../build/${buildType}/binding_noexcept_maybe.node`), ].map(it => require.resolve(it)); for (const item of bindings) { @@ -96,6 +97,7 @@ exports.runTestWithBindingPath = async function(test, buildType, buildPathRoot = const bindings = [ path.join(buildPathRoot, `../build/${buildType}/binding.node`), path.join(buildPathRoot, `../build/${buildType}/binding_noexcept.node`), + path.join(buildPathRoot, `../build/${buildType}/binding_noexcept_maybe.node`), ].map(it => require.resolve(it)); for (const item of bindings) { diff --git a/test/function.cc b/test/function.cc index 55252fc5a..0fab27290 100644 --- a/test/function.cc +++ b/test/function.cc @@ -115,13 +115,8 @@ Value CallWithInvalidReceiver(const CallbackInfo& info) { Value CallConstructorWithArgs(const CallbackInfo& info) { Function func = info[0].As(); -<<<<<<< HEAD return MaybeUnwrap( func.New(std::initializer_list{info[1], info[2], info[3]})); -======= - return func.New( - std::initializer_list{info[1], info[2], info[3]}); ->>>>>>> 637e422... run tests with options to prefix build root path } Value CallConstructorWithVector(const CallbackInfo& info) {