@@ -51,10 +51,9 @@ CHAR_TEST(16, IsUnicodeSurrogate, (ch & 0xF800) == 0xD800)
51
51
// If a UTF-16 surrogate is a low/trailing one.
52
52
CHAR_TEST (16 , IsUnicodeSurrogateTrail, (ch & 0x400 ) != 0 )
53
53
54
- static void GetOwnNonIndexProperties (
55
- const FunctionCallbackInfo<Value>& args) {
56
- Environment* env = Environment::GetCurrent (args);
57
- Local<Context> context = env->context ();
54
+ static void GetOwnNonIndexProperties (const FunctionCallbackInfo<Value>& args) {
55
+ Isolate* isolate = args.GetIsolate ();
56
+ Local<Context> context = isolate->GetCurrentContext ();
58
57
59
58
CHECK (args[0 ]->IsObject ());
60
59
CHECK (args[1 ]->IsUint32 ());
@@ -65,18 +64,18 @@ static void GetOwnNonIndexProperties(
65
64
66
65
PropertyFilter filter = FromV8Value<PropertyFilter>(args[1 ]);
67
66
68
- if (!object->GetPropertyNames (
69
- context, KeyCollectionMode::kOwnOnly ,
70
- filter,
71
- IndexFilter::kSkipIndices )
72
- .ToLocal (&properties)) {
67
+ if (!object
68
+ ->GetPropertyNames (context,
69
+ KeyCollectionMode::kOwnOnly ,
70
+ filter,
71
+ IndexFilter::kSkipIndices )
72
+ .ToLocal (&properties)) {
73
73
return ;
74
74
}
75
75
args.GetReturnValue ().Set (properties);
76
76
}
77
77
78
- static void GetConstructorName (
79
- const FunctionCallbackInfo<Value>& args) {
78
+ static void GetConstructorName (const FunctionCallbackInfo<Value>& args) {
80
79
CHECK (args[0 ]->IsObject ());
81
80
82
81
Local<Object> object = args[0 ].As <Object>();
@@ -85,8 +84,7 @@ static void GetConstructorName(
85
84
args.GetReturnValue ().Set (name);
86
85
}
87
86
88
- static void GetExternalValue (
89
- const FunctionCallbackInfo<Value>& args) {
87
+ static void GetExternalValue (const FunctionCallbackInfo<Value>& args) {
90
88
CHECK (args[0 ]->IsExternal ());
91
89
Isolate* isolate = args.GetIsolate ();
92
90
Local<External> external = args[0 ].As <External>();
@@ -99,15 +97,14 @@ static void GetExternalValue(
99
97
100
98
static void GetPromiseDetails (const FunctionCallbackInfo<Value>& args) {
101
99
// Return undefined if it's not a Promise.
102
- if (!args[0 ]->IsPromise ())
103
- return ;
100
+ if (!args[0 ]->IsPromise ()) return ;
104
101
105
102
auto isolate = args.GetIsolate ();
106
103
107
104
Local<Promise> promise = args[0 ].As <Promise>();
108
105
109
106
int state = promise->State ();
110
- Local<Value> values[2 ] = { Integer::New (isolate, state) };
107
+ Local<Value> values[2 ] = {Integer::New (isolate, state)};
111
108
size_t number_of_values = 1 ;
112
109
if (state != Promise::PromiseState::kPending )
113
110
values[number_of_values++] = promise->Result ();
@@ -117,19 +114,15 @@ static void GetPromiseDetails(const FunctionCallbackInfo<Value>& args) {
117
114
118
115
static void GetProxyDetails (const FunctionCallbackInfo<Value>& args) {
119
116
// Return undefined if it's not a proxy.
120
- if (!args[0 ]->IsProxy ())
121
- return ;
117
+ if (!args[0 ]->IsProxy ()) return ;
122
118
123
119
Local<Proxy> proxy = args[0 ].As <Proxy>();
124
120
125
121
// TODO(BridgeAR): Remove the length check as soon as we prohibit access to
126
122
// the util binding layer. It's accessed in the wild and `esm` would break in
127
123
// case the check is removed.
128
124
if (args.Length () == 1 || args[1 ]->IsTrue ()) {
129
- Local<Value> ret[] = {
130
- proxy->GetTarget (),
131
- proxy->GetHandler ()
132
- };
125
+ Local<Value> ret[] = {proxy->GetTarget (), proxy->GetHandler ()};
133
126
134
127
args.GetReturnValue ().Set (
135
128
Array::New (args.GetIsolate (), ret, arraysize (ret)));
@@ -165,24 +158,18 @@ static void GetCallerLocation(const FunctionCallbackInfo<Value>& args) {
165
158
}
166
159
167
160
static void PreviewEntries (const FunctionCallbackInfo<Value>& args) {
168
- if (!args[0 ]->IsObject ())
169
- return ;
161
+ if (!args[0 ]->IsObject ()) return ;
170
162
171
- Environment* env = Environment::GetCurrent ( args);
163
+ Isolate* isolate = args. GetIsolate ( );
172
164
bool is_key_value;
173
165
Local<Array> entries;
174
166
if (!args[0 ].As <Object>()->PreviewEntries (&is_key_value).ToLocal (&entries))
175
167
return ;
176
168
// Fast path for WeakMap and WeakSet.
177
- if (args.Length () == 1 )
178
- return args.GetReturnValue ().Set (entries);
179
-
180
- Local<Value> ret[] = {
181
- entries,
182
- Boolean::New (env->isolate (), is_key_value)
183
- };
184
- return args.GetReturnValue ().Set (
185
- Array::New (env->isolate (), ret, arraysize (ret)));
169
+ if (args.Length () == 1 ) return args.GetReturnValue ().Set (entries);
170
+
171
+ Local<Value> ret[] = {entries, Boolean::New (isolate, is_key_value)};
172
+ return args.GetReturnValue ().Set (Array::New (isolate, ret, arraysize (ret)));
186
173
}
187
174
188
175
static void Sleep (const FunctionCallbackInfo<Value>& args) {
@@ -222,9 +209,9 @@ static uint32_t GetUVHandleTypeCode(const uv_handle_type type) {
222
209
}
223
210
224
211
static void GuessHandleType (const FunctionCallbackInfo<Value>& args) {
225
- Environment* env = Environment::GetCurrent (args);
226
212
int fd;
227
- if (!args[0 ]->Int32Value (env->context ()).To (&fd)) return ;
213
+ if (!args[0 ]->Int32Value (args.GetIsolate ()->GetCurrentContext ()).To (&fd))
214
+ return ;
228
215
CHECK_GE (fd, 0 );
229
216
230
217
uv_handle_type t = uv_guess_handle (fd);
0 commit comments