@@ -306,48 +306,32 @@ MaybeLocal<Value> Environment::BootstrapNode() {
306
306
return scope.EscapeMaybe (result);
307
307
}
308
308
309
- if (is_main_thread ()) {
310
- result = ExecuteBootstrapper (this ,
311
- " internal/bootstrap/switches/is_main_thread" ,
312
- &node_params,
313
- &node_args);
314
- } else {
315
- result =
316
- ExecuteBootstrapper (this ,
317
- " internal/bootstrap/switches/is_not_main_thread" ,
318
- &node_params,
319
- &node_args);
320
- }
309
+ auto thread_switch_id =
310
+ is_main_thread () ? " internal/bootstrap/switches/is_main_thread"
311
+ : " internal/bootstrap/switches/is_not_main_thread" ;
312
+ result =
313
+ ExecuteBootstrapper (this , thread_switch_id, &node_params, &node_args);
321
314
322
315
if (result.IsEmpty ()) {
323
316
return scope.EscapeMaybe (result);
324
317
}
325
318
326
- if (owns_process_state ()) {
327
- result = ExecuteBootstrapper (
328
- this ,
329
- " internal/bootstrap/switches/does_own_process_state" ,
330
- &node_params,
331
- &node_args);
332
- } else {
333
- result = ExecuteBootstrapper (
334
- this ,
335
- " internal/bootstrap/switches/does_not_own_process_state" ,
336
- &node_params,
337
- &node_args);
338
- }
319
+ auto process_state_switch_id =
320
+ owns_process_state ()
321
+ ? " internal/bootstrap/switches/does_own_process_state"
322
+ : " internal/bootstrap/switches/does_not_own_process_state" ;
323
+ result = ExecuteBootstrapper (
324
+ this , process_state_switch_id, &node_params, &node_args);
339
325
340
326
if (result.IsEmpty ()) {
341
327
return scope.EscapeMaybe (result);
342
328
}
343
329
330
+ Local<String> env_string = FIXED_ONE_BYTE_STRING (isolate_, " env" );
344
331
Local<Object> env_var_proxy;
345
332
if (!CreateEnvVarProxy (context (), isolate_, as_callback_data ())
346
333
.ToLocal (&env_var_proxy) ||
347
- process_object ()
348
- ->Set (
349
- context (), FIXED_ONE_BYTE_STRING (isolate_, " env" ), env_var_proxy)
350
- .IsNothing ()) {
334
+ process_object ()->Set (context (), env_string, env_var_proxy).IsNothing ()) {
351
335
return MaybeLocal<Value>();
352
336
}
353
337
0 commit comments