Skip to content

Commit df89e4b

Browse files
committed
fixup! pacify linter
1 parent e9d6d72 commit df89e4b

File tree

3 files changed

+59
-59
lines changed

3 files changed

+59
-59
lines changed

src/base_object-inl.h

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ T* BaseObject::FromJSObject(v8::Local<v8::Value> object) {
7373
return static_cast<T*>(FromJSObject(object));
7474
}
7575

76-
7776
void BaseObject::OnGCCollect() {
7877
delete this;
7978
}

src/env.cc

+55-56
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ void AsyncHooks::push_async_context(double async_id,
9595
}
9696

9797
uint32_t offset = fields_[kStackLength];
98-
if (offset * 2 >= async_ids_stack_.Length())
99-
grow_async_ids_stack();
98+
if (offset * 2 >= async_ids_stack_.Length()) grow_async_ids_stack();
10099
async_ids_stack_[2 * offset] = async_id_fields_[kExecutionAsyncId];
101100
async_ids_stack_[2 * offset + 1] = async_id_fields_[kTriggerAsyncId];
102101
fields_[kStackLength] += 1;
@@ -138,8 +137,7 @@ bool AsyncHooks::pop_async_context(double async_id) {
138137
if (LIKELY(offset < native_execution_async_resources_.size() &&
139138
!native_execution_async_resources_[offset].IsEmpty())) {
140139
#ifdef DEBUG
141-
for (uint32_t i = offset + 1;
142-
i < native_execution_async_resources_.size();
140+
for (uint32_t i = offset + 1; i < native_execution_async_resources_.size();
143141
i++) {
144142
CHECK(native_execution_async_resources_[i].IsEmpty());
145143
}
@@ -167,10 +165,10 @@ void AsyncHooks::clear_async_id_stack() {
167165
Isolate* isolate = env()->isolate();
168166
HandleScope handle_scope(isolate);
169167
if (!js_execution_async_resources_.IsEmpty()) {
170-
USE(PersistentToLocal::Strong(js_execution_async_resources_)->Set(
171-
env()->context(),
172-
env()->length_string(),
173-
Integer::NewFromUnsigned(isolate, 0)));
168+
USE(PersistentToLocal::Strong(js_execution_async_resources_)
169+
->Set(env()->context(),
170+
env()->length_string(),
171+
Integer::NewFromUnsigned(isolate, 0)));
174172
}
175173
native_execution_async_resources_.clear();
176174
native_execution_async_resources_.shrink_to_fit();
@@ -181,19 +179,18 @@ void AsyncHooks::clear_async_id_stack() {
181179
}
182180

183181
void AsyncHooks::AddContext(Local<Context> ctx) {
184-
ctx->SetPromiseHooks(
185-
js_promise_hooks_[0].IsEmpty() ?
186-
Local<Function>() :
187-
PersistentToLocal::Strong(js_promise_hooks_[0]),
188-
js_promise_hooks_[1].IsEmpty() ?
189-
Local<Function>() :
190-
PersistentToLocal::Strong(js_promise_hooks_[1]),
191-
js_promise_hooks_[2].IsEmpty() ?
192-
Local<Function>() :
193-
PersistentToLocal::Strong(js_promise_hooks_[2]),
194-
js_promise_hooks_[3].IsEmpty() ?
195-
Local<Function>() :
196-
PersistentToLocal::Strong(js_promise_hooks_[3]));
182+
ctx->SetPromiseHooks(js_promise_hooks_[0].IsEmpty()
183+
? Local<Function>()
184+
: PersistentToLocal::Strong(js_promise_hooks_[0]),
185+
js_promise_hooks_[1].IsEmpty()
186+
? Local<Function>()
187+
: PersistentToLocal::Strong(js_promise_hooks_[1]),
188+
js_promise_hooks_[2].IsEmpty()
189+
? Local<Function>()
190+
: PersistentToLocal::Strong(js_promise_hooks_[2]),
191+
js_promise_hooks_[3].IsEmpty()
192+
? Local<Function>()
193+
: PersistentToLocal::Strong(js_promise_hooks_[3]));
197194

198195
size_t id = contexts_.size();
199196
contexts_.resize(id + 1);
@@ -209,8 +206,7 @@ void AsyncHooks::RemoveContext(Local<Context> ctx) {
209206
[&](auto&& el) { return el.IsEmpty(); }),
210207
contexts_.end());
211208
for (auto it = contexts_.begin(); it != contexts_.end(); it++) {
212-
Local<Context> saved_context =
213-
PersistentToLocal::Weak(isolate, *it);
209+
Local<Context> saved_context = PersistentToLocal::Weak(isolate, *it);
214210
if (saved_context == ctx) {
215211
it->Reset();
216212
contexts_.erase(it);
@@ -227,14 +223,14 @@ AsyncHooks::DefaultTriggerAsyncIdScope::DefaultTriggerAsyncIdScope(
227223
}
228224

229225
old_default_trigger_async_id_ =
230-
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId];
226+
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId];
231227
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
232-
default_trigger_async_id;
228+
default_trigger_async_id;
233229
}
234230

235231
AsyncHooks::DefaultTriggerAsyncIdScope::~DefaultTriggerAsyncIdScope() {
236232
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
237-
old_default_trigger_async_id_;
233+
old_default_trigger_async_id_;
238234
}
239235

240236
AsyncHooks::DefaultTriggerAsyncIdScope::DefaultTriggerAsyncIdScope(
@@ -435,11 +431,11 @@ void TrackingTraceStateObserver::UpdateTraceCategoryState() {
435431

436432
void Environment::AssignToContext(Local<v8::Context> context,
437433
const ContextInfo& info) {
438-
context->SetAlignedPointerInEmbedderData(
439-
ContextEmbedderIndex::kEnvironment, this);
434+
context->SetAlignedPointerInEmbedderData(ContextEmbedderIndex::kEnvironment,
435+
this);
440436
// Used by Environment::GetCurrent to know that we are on a node context.
441-
context->SetAlignedPointerInEmbedderData(
442-
ContextEmbedderIndex::kContextTag, Environment::kNodeContextTagPtr);
437+
context->SetAlignedPointerInEmbedderData(ContextEmbedderIndex::kContextTag,
438+
Environment::kNodeContextTagPtr);
443439
// Used to retrieve bindings
444440
context->SetAlignedPointerInEmbedderData(
445441
ContextEmbedderIndex::kBindingListIndex, &(this->bindings_));
@@ -452,7 +448,8 @@ void Environment::AssignToContext(Local<v8::Context> context,
452448
}
453449

454450
void Environment::TryLoadAddon(
455-
const char* filename, int flags,
451+
const char* filename,
452+
int flags,
456453
const std::function<bool(binding::DLib*)>& was_loaded) {
457454
loaded_addons_.emplace_back(filename, flags);
458455
if (!was_loaded(&loaded_addons_.back())) {
@@ -485,8 +482,7 @@ void Environment::add_refs(int64_t diff) {
485482
uv_ref(reinterpret_cast<uv_handle_t*>(&task_queues_async_));
486483
}
487484

488-
uv_buf_t Environment::allocate_managed_buffer(
489-
const size_t suggested_size) {
485+
uv_buf_t Environment::allocate_managed_buffer(const size_t suggested_size) {
490486
NoArrayBufferZeroFillScope no_zero_fill_scope(isolate_data());
491487
std::unique_ptr<v8::BackingStore> bs =
492488
v8::ArrayBuffer::NewBackingStore(isolate(), suggested_size);
@@ -528,7 +524,8 @@ void Environment::SetMethod(Local<v8::Object> that,
528524
v8::FunctionCallback callback) {
529525
Local<v8::Context> context = isolate()->GetCurrentContext();
530526
Local<v8::Function> function =
531-
NewFunctionTemplate(callback, Local<v8::Signature>(),
527+
NewFunctionTemplate(callback,
528+
Local<v8::Signature>(),
532529
v8::ConstructorBehavior::kThrow,
533530
v8::SideEffectType::kHasSideEffect)
534531
->GetFunction(context)
@@ -565,7 +562,8 @@ void Environment::SetMethodNoSideEffect(Local<v8::Object> that,
565562
v8::FunctionCallback callback) {
566563
Local<v8::Context> context = isolate()->GetCurrentContext();
567564
Local<v8::Function> function =
568-
NewFunctionTemplate(callback, Local<v8::Signature>(),
565+
NewFunctionTemplate(callback,
566+
Local<v8::Signature>(),
569567
v8::ConstructorBehavior::kThrow,
570568
v8::SideEffectType::kHasNoSideEffect)
571569
->GetFunction(context)
@@ -583,7 +581,9 @@ void Environment::SetProtoMethod(Local<v8::FunctionTemplate> that,
583581
v8::FunctionCallback callback) {
584582
Local<v8::Signature> signature = v8::Signature::New(isolate(), that);
585583
Local<v8::FunctionTemplate> t =
586-
NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow,
584+
NewFunctionTemplate(callback,
585+
signature,
586+
v8::ConstructorBehavior::kThrow,
587587
v8::SideEffectType::kHasSideEffect);
588588
// kInternalized strings are created in the old space.
589589
const v8::NewStringType type = v8::NewStringType::kInternalized;
@@ -593,13 +593,14 @@ void Environment::SetProtoMethod(Local<v8::FunctionTemplate> that,
593593
t->SetClassName(name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility.
594594
}
595595

596-
void Environment::SetProtoMethodNoSideEffect(
597-
Local<v8::FunctionTemplate> that,
598-
const char* name,
599-
v8::FunctionCallback callback) {
596+
void Environment::SetProtoMethodNoSideEffect(Local<v8::FunctionTemplate> that,
597+
const char* name,
598+
v8::FunctionCallback callback) {
600599
Local<v8::Signature> signature = v8::Signature::New(isolate(), that);
601600
Local<v8::FunctionTemplate> t =
602-
NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow,
601+
NewFunctionTemplate(callback,
602+
signature,
603+
v8::ConstructorBehavior::kThrow,
603604
v8::SideEffectType::kHasNoSideEffect);
604605
// kInternalized strings are created in the old space.
605606
const v8::NewStringType type = v8::NewStringType::kInternalized;
@@ -614,7 +615,9 @@ void Environment::SetInstanceMethod(Local<v8::FunctionTemplate> that,
614615
v8::FunctionCallback callback) {
615616
Local<v8::Signature> signature = v8::Signature::New(isolate(), that);
616617
Local<v8::FunctionTemplate> t =
617-
NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow,
618+
NewFunctionTemplate(callback,
619+
signature,
620+
v8::ConstructorBehavior::kThrow,
618621
v8::SideEffectType::kHasSideEffect);
619622
// kInternalized strings are created in the old space.
620623
const v8::NewStringType type = v8::NewStringType::kInternalized;
@@ -637,10 +640,8 @@ void Environment::SetConstructorFunction(Local<v8::Object> that,
637640
SetConstructorFunctionFlag flag) {
638641
if (LIKELY(flag == SetConstructorFunctionFlag::SET_CLASS_NAME))
639642
tmpl->SetClassName(name);
640-
that->Set(
641-
context(),
642-
name,
643-
tmpl->GetFunction(context()).ToLocalChecked()).Check();
643+
that->Set(context(), name, tmpl->GetFunction(context()).ToLocalChecked())
644+
.Check();
644645
}
645646

646647
void Environment::CreateProperties() {
@@ -2126,9 +2127,8 @@ BaseObject::BaseObject(Environment* env, Local<Object> object)
21262127
: persistent_handle_(env->isolate(), object), env_(env) {
21272128
CHECK_EQ(false, object.IsEmpty());
21282129
CHECK_GT(object->InternalFieldCount(), 0);
2129-
object->SetAlignedPointerInInternalField(
2130-
BaseObject::kSlot,
2131-
static_cast<void*>(this));
2130+
object->SetAlignedPointerInInternalField(BaseObject::kSlot,
2131+
static_cast<void*>(this));
21322132
env->AddCleanupHook(DeleteMe, static_cast<void*>(this));
21332133
env->modify_base_object_count(1);
21342134
}
@@ -2141,8 +2141,7 @@ BaseObject::~BaseObject() {
21412141
PointerData* metadata = pointer_data();
21422142
CHECK_EQ(metadata->strong_ptr_count, 0);
21432143
metadata->self = nullptr;
2144-
if (metadata->weak_ptr_count == 0)
2145-
delete metadata;
2144+
if (metadata->weak_ptr_count == 0) delete metadata;
21462145
}
21472146

21482147
if (persistent_handle_.IsEmpty()) {
@@ -2174,7 +2173,8 @@ void BaseObject::MakeWeak() {
21742173
CHECK_IMPLIES(obj->has_pointer_data(),
21752174
obj->pointer_data()->strong_ptr_count == 0);
21762175
obj->OnGCCollect();
2177-
}, WeakCallbackType::kParameter);
2176+
},
2177+
WeakCallbackType::kParameter);
21782178
}
21792179

21802180
void BaseObject::LazilyInitializedJSTemplateConstructor(
@@ -2184,13 +2184,12 @@ void BaseObject::LazilyInitializedJSTemplateConstructor(
21842184
args.This()->SetAlignedPointerInInternalField(BaseObject::kSlot, nullptr);
21852185
}
21862186

2187-
Local<FunctionTemplate>
2188-
BaseObject::MakeLazilyInitializedJSTemplate(Environment* env) {
2187+
Local<FunctionTemplate> BaseObject::MakeLazilyInitializedJSTemplate(
2188+
Environment* env) {
21892189
Local<FunctionTemplate> t =
21902190
env->NewFunctionTemplate(LazilyInitializedJSTemplateConstructor);
21912191
t->Inherit(BaseObject::GetConstructorTemplate(env));
2192-
t->InstanceTemplate()->SetInternalFieldCount(
2193-
BaseObject::kInternalFieldCount);
2192+
t->InstanceTemplate()->SetInternalFieldCount(BaseObject::kInternalFieldCount);
21942193
return t;
21952194
}
21962195

src/env.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,8 @@ class AsyncHooks : public MemoryRetainer {
742742
// NB: This call does not take (co-)ownership of `execution_async_resource`.
743743
// The lifetime of the `v8::Local<>` pointee must last until
744744
// `pop_async_context()` or `clear_async_id_stack()` are called.
745-
void push_async_context(double async_id, double trigger_async_id,
745+
void push_async_context(double async_id,
746+
double trigger_async_id,
746747
v8::Local<v8::Object> execution_async_resource);
747748
bool pop_async_context(double async_id);
748749
void clear_async_id_stack(); // Used in fatal exceptions.
@@ -1134,7 +1135,8 @@ class Environment : public MemoryRetainer {
11341135

11351136
inline v8::Isolate* isolate() const;
11361137
inline uv_loop_t* event_loop() const;
1137-
void TryLoadAddon(const char* filename, int flags,
1138+
void TryLoadAddon(const char* filename,
1139+
int flags,
11381140
const std::function<bool(binding::DLib*)>& was_loaded);
11391141

11401142
static inline Environment* from_timer_handle(uv_timer_t* handle);

0 commit comments

Comments
 (0)