Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit c057e77

Browse files
committed
deps,src,test: fixing lint errors
PR-URL: #465 Reviewed-By: Kyle Farnung <kfarnung@microsoft.com> Reviewed-By: Seth Brenith <sethb@microsoft.com>
1 parent 3785924 commit c057e77

File tree

6 files changed

+81
-34
lines changed

6 files changed

+81
-34
lines changed

deps/chakrashim/src/v8arraybuffer.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ ArrayBuffer::Contents ArrayBuffer::GetContents() {
105105
}
106106

107107
Contents contents;
108-
if (buffer == nullptr)
109-
{
108+
if (buffer == nullptr) {
110109
CHAKRA_ASSERT(bufferLength == 0);
111-
// v8's version of ArrayBuffer will return a non-null pointer even in the case of
112-
// an empty ArrayBuffer, and this behavior is relied upon by some of the i18n code.
113-
// To support that, if we would otherwise return a null buffer, as long as the
114-
// length is 0 we instead return a valid pointer to something, on the understanding
115-
// that nobody will actually try to read it.
116-
buffer = (BYTE*)this;
110+
// v8's version of ArrayBuffer will return a non-null pointer even in the
111+
// case of an empty ArrayBuffer, and this behavior is relied upon by some
112+
// of the i18n code. To support that, if we would otherwise return a null
113+
// buffer, as long as the length is 0 we instead return a valid pointer
114+
// to something, on the understanding that nobody will actually try to
115+
// read it.
116+
buffer = reinterpret_cast<BYTE*>(this);
117117
}
118118
contents.data_ = buffer;
119119
contents.byte_length_ = bufferLength;

deps/chakrashim/src/v8promise.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,28 @@ Promise::Promise() { }
2727

2828
Local<Value> Promise::Result() {
2929
JsValueRef value;
30-
if (jsrt::GetProperty(this, jsrt::CachedPropertyIdRef::value, &value) != JsNoError) {
30+
if (jsrt::GetProperty(
31+
this,
32+
jsrt::CachedPropertyIdRef::value,
33+
&value) != JsNoError) {
3134
return Local<Value>();
3235
}
3336
return Local<Value>::New(value);
3437
}
3538

3639
Promise::PromiseState Promise::State() {
3740
JsValueRef state;
38-
if (jsrt::GetProperty(this, jsrt::CachedPropertyIdRef::state, &state) != JsNoError) {
41+
if (jsrt::GetProperty(
42+
this,
43+
jsrt::CachedPropertyIdRef::state,
44+
&state) != JsNoError) {
3945
return PromiseState::kPending;
4046
}
4147
int stateNumber;
4248
if (JsNumberToInt(state, &stateNumber) != JsNoError) {
4349
return PromiseState::kPending;
4450
}
45-
switch(stateNumber) {
51+
switch (stateNumber) {
4652
case 1: return PromiseState::kFulfilled;
4753
case 2: return PromiseState::kRejected;
4854
default: return PromiseState::kPending;

deps/chakrashim/src/v8resolver.cc

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,33 @@ namespace v8 {
3535
return Local<Resolver>();
3636
}
3737

38-
if (jsrt::SetProperty(resolver, jsrt::CachedPropertyIdRef::promise, promise) != JsNoError) {
38+
if (jsrt::SetProperty(
39+
resolver,
40+
jsrt::CachedPropertyIdRef::promise,
41+
promise) != JsNoError) {
3942
return Local<Resolver>();
4043
}
4144

42-
if (jsrt::SetProperty(resolver, jsrt::CachedPropertyIdRef::resolve, resolve) != JsNoError) {
45+
if (jsrt::SetProperty(
46+
resolver,
47+
jsrt::CachedPropertyIdRef::resolve,
48+
resolve) != JsNoError) {
4349
return Local<Resolver>();
4450
}
4551

46-
if (jsrt::SetProperty(resolver, jsrt::CachedPropertyIdRef::reject, reject) != JsNoError) {
52+
if (jsrt::SetProperty(
53+
resolver,
54+
jsrt::CachedPropertyIdRef::reject,
55+
reject) != JsNoError) {
4756
return Local<Resolver>();
4857
}
4958

5059
JsValueRef state;
5160
jsrt::UintToValue(0, &state);
52-
if (jsrt::SetProperty(promise, jsrt::CachedPropertyIdRef::value, state) != JsNoError) {
61+
if (jsrt::SetProperty(
62+
promise,
63+
jsrt::CachedPropertyIdRef::value,
64+
state) != JsNoError) {
5365
return Local<Resolver>();
5466
}
5567

@@ -62,7 +74,10 @@ namespace v8 {
6274

6375
Local<Promise> Resolver::GetPromise() {
6476
JsValueRef promise;
65-
if (jsrt::GetProperty(this, jsrt::CachedPropertyIdRef::promise, &promise) != JsNoError) {
77+
if (jsrt::GetProperty(
78+
this,
79+
jsrt::CachedPropertyIdRef::promise,
80+
&promise) != JsNoError) {
6681
return Local<Promise>();
6782
}
6883
return Local<Promise>::New(static_cast<Promise*>(promise));
@@ -74,28 +89,40 @@ namespace v8 {
7489

7590
Maybe<bool> Resolver::Resolve(Local<Context> context, Local<Value> value) {
7691
JsValueRef resolve;
77-
if (jsrt::GetProperty(this, jsrt::CachedPropertyIdRef::resolve, &resolve) != JsNoError) {
92+
if (jsrt::GetProperty(
93+
this,
94+
jsrt::CachedPropertyIdRef::resolve,
95+
&resolve) != JsNoError) {
7896
return Nothing<bool>();
7997
}
8098

8199
JsValueRef promise;
82-
if (jsrt::GetProperty(this, jsrt::CachedPropertyIdRef::promise, &promise) != JsNoError) {
100+
if (jsrt::GetProperty(
101+
this,
102+
jsrt::CachedPropertyIdRef::promise,
103+
&promise) != JsNoError) {
83104
return Nothing<bool>();
84105
}
85106

86-
if (jsrt::SetProperty(promise, jsrt::CachedPropertyIdRef::value, *value) != JsNoError) {
107+
if (jsrt::SetProperty(
108+
promise,
109+
jsrt::CachedPropertyIdRef::value,
110+
*value) != JsNoError) {
87111
return Nothing<bool>();
88112
}
89113

90114
JsValueRef state;
91115
jsrt::UintToValue(1, &state);
92-
if (jsrt::SetProperty(promise, jsrt::CachedPropertyIdRef::value, state) != JsNoError) {
116+
if (jsrt::SetProperty(
117+
promise,
118+
jsrt::CachedPropertyIdRef::value,
119+
state) != JsNoError) {
93120
return Nothing<bool>();
94121
}
95-
122+
96123
JsValueRef result;
97124
JsValueRef args[2];
98-
args[0] = this; // ? What is the "this" of the resolver here?
125+
args[0] = this; // ? What is the "this" of the resolver here?
99126
args[1] = reinterpret_cast<JsValueRef>(*value);
100127

101128
if (JsCallFunction(resolve, args, 2, &result) != JsNoError) {
@@ -112,28 +139,40 @@ namespace v8 {
112139

113140
Maybe<bool> Resolver::Reject(Local<Context> context, Local<Value> value) {
114141
JsValueRef reject;
115-
if (jsrt::GetProperty(this, jsrt::CachedPropertyIdRef::reject, &reject) != JsNoError) {
142+
if (jsrt::GetProperty(
143+
this,
144+
jsrt::CachedPropertyIdRef::reject,
145+
&reject) != JsNoError) {
116146
return Nothing<bool>();
117147
}
118148

119149
JsValueRef promise;
120-
if (jsrt::GetProperty(this, jsrt::CachedPropertyIdRef::promise, &promise) != JsNoError) {
150+
if (jsrt::GetProperty(
151+
this,
152+
jsrt::CachedPropertyIdRef::promise,
153+
&promise) != JsNoError) {
121154
return Nothing<bool>();
122155
}
123156

124-
if (jsrt::SetProperty(promise, jsrt::CachedPropertyIdRef::value, *value) != JsNoError) {
157+
if (jsrt::SetProperty(
158+
promise,
159+
jsrt::CachedPropertyIdRef::value,
160+
*value) != JsNoError) {
125161
return Nothing<bool>();
126162
}
127163

128164
JsValueRef state;
129165
jsrt::UintToValue(2, &state);
130-
if (jsrt::SetProperty(promise, jsrt::CachedPropertyIdRef::value, state) != JsNoError) {
166+
if (jsrt::SetProperty(
167+
promise,
168+
jsrt::CachedPropertyIdRef::value,
169+
state) != JsNoError) {
131170
return Nothing<bool>();
132171
}
133-
172+
134173
JsValueRef result;
135174
JsValueRef args[2];
136-
args[0] = this; // ? What is the "this" of the resolver here?
175+
args[0] = this; // ? What is the "this" of the resolver here?
137176
args[1] = reinterpret_cast<JsValueRef>(*value);
138177

139178
if (JsCallFunction(reject, args, 2, &result) != JsNoError) {

src/node_api_jsrt.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,15 +2119,16 @@ napi_status napi_open_callback_scope(napi_env env,
21192119
node::async_context* node_async_context =
21202120
reinterpret_cast<node::async_context*>(async_context_handle);
21212121

2122-
// TODO: It'd be nice if we could remove the dependency on v8::*
2122+
// TODO(MSLaguana): It'd be nice if we could remove the dependency on v8::*
21232123
// from here by changing node::CallbackScope's signature
21242124
v8::Local<v8::Object> resource =
21252125
v8impl::V8LocalValueFromJsValue(resource_object).As<v8::Object>();
21262126

21272127
*result = reinterpret_cast<napi_callback_scope>(
2128-
new node::InternalCallbackScope(node::Environment::GetCurrent(env->isolate),
2129-
resource,
2130-
*node_async_context));
2128+
new node::InternalCallbackScope(
2129+
node::Environment::GetCurrent(env->isolate),
2130+
resource,
2131+
*node_async_context));
21312132

21322133
napi_clear_last_error();
21332134
return napi_ok;

src/node_contextify.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void ContextifyContext::PropertySetterCallback(
393393

394394
ctx->sandbox()->Set(property, value);
395395
#else
396-
bool is_declared =
396+
bool is_declared =
397397
ctx->global_proxy()->HasRealNamedProperty(ctx->context(),
398398
property).FromJust();
399399

test/cctest/node_test_fixture.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ class EnvironmentTestFixture : public NodeTestFixture {
103103
Env(const v8::HandleScope& handle_scope, const Argv& argv) {
104104
auto isolate = handle_scope.GetIsolate();
105105
#if ENABLE_TTD_NODE
106-
context_ = node::NewContext(isolate, false); // TODO: should we support TTD in cctest?
106+
// TODO(MSLaguana): should we support TTD in cctest?
107+
context_ = node::NewContext(isolate, false);
107108
#else
108109
context_ = node::NewContext(isolate);
109110
#endif

0 commit comments

Comments
 (0)