Skip to content

Commit

Permalink
src: clang_format base_object
Browse files Browse the repository at this point in the history
PR-URL: #33680
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
yashLadha authored and codebytere committed Jul 12, 2020
1 parent 998b22c commit 9e1185a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/base_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include <type_traits> // std::remove_reference
#include "memory_tracker.h"
#include "v8.h"
#include <type_traits> // std::remove_reference

namespace node {

Expand Down Expand Up @@ -84,7 +84,7 @@ class BaseObject : public MemoryRetainer {
template <int Field>
static void InternalFieldGet(v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info);
template <int Field, bool (v8::Value::* typecheck)() const>
template <int Field, bool (v8::Value::*typecheck)() const>
static void InternalFieldSet(v8::Local<v8::String> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info);
Expand Down Expand Up @@ -157,13 +157,11 @@ inline T* Unwrap(v8::Local<v8::Object> obj) {
return BaseObject::FromJSObject<T>(obj);
}


#define ASSIGN_OR_RETURN_UNWRAP(ptr, obj, ...) \
do { \
*ptr = static_cast<typename std::remove_reference<decltype(*ptr)>::type>( \
BaseObject::FromJSObject(obj)); \
if (*ptr == nullptr) \
return __VA_ARGS__; \
#define ASSIGN_OR_RETURN_UNWRAP(ptr, obj, ...) \
do { \
*ptr = static_cast<typename std::remove_reference<decltype(*ptr)>::type>( \
BaseObject::FromJSObject(obj)); \
if (*ptr == nullptr) return __VA_ARGS__; \
} while (0)

// Implementation of a generic strong or weak pointer to a BaseObject.
Expand Down Expand Up @@ -199,7 +197,7 @@ class BaseObjectPtrImpl final {

private:
union {
BaseObject* target; // Used for strong pointers.
BaseObject* target; // Used for strong pointers.
BaseObject::PointerData* pointer_data; // Used for weak pointers.
} data_;

Expand Down

0 comments on commit 9e1185a

Please sign in to comment.