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