@@ -2818,16 +2818,14 @@ inline MaybeOrValue<Promise> Promise::Then(napi_value onFulfilled) const {
2818
2818
#ifdef NODE_ADDON_API_ENABLE_MAYBE
2819
2819
MaybeOrValue<Value> thenMethodMaybe = Get (" then" );
2820
2820
Function thenMethod = thenMethodMaybe.Unwrap ().As <Function>();
2821
- #else
2822
- Function thenMethod = Get (" then" ).As <Function>();
2823
- #endif
2824
2821
MaybeOrValue<Value> result = thenMethod.Call (*this , {onFulfilled});
2825
- #ifdef NODE_ADDON_API_ENABLE_MAYBE
2826
2822
if (result.IsJust ()) {
2827
2823
return Just (scope.Escape (result.Unwrap ()).As <Promise>());
2828
2824
}
2829
2825
return Nothing<Promise>();
2830
2826
#else
2827
+ Function thenMethod = Get (" then" ).As <Function>();
2828
+ MaybeOrValue<Value> result = thenMethod.Call (*this , {onFulfilled});
2831
2829
if (scope.Env ().IsExceptionPending ()) {
2832
2830
return Promise ();
2833
2831
}
@@ -2840,16 +2838,14 @@ inline MaybeOrValue<Promise> Promise::Then(napi_value onFulfilled, napi_value on
2840
2838
#ifdef NODE_ADDON_API_ENABLE_MAYBE
2841
2839
MaybeOrValue<Value> thenMethodMaybe = Get (" then" );
2842
2840
Function thenMethod = thenMethodMaybe.Unwrap ().As <Function>();
2843
- #else
2844
- Function thenMethod = Get (" then" ).As <Function>();
2845
- #endif
2846
2841
MaybeOrValue<Value> result = thenMethod.Call (*this , {onFulfilled, onRejected});
2847
- #ifdef NODE_ADDON_API_ENABLE_MAYBE
2848
2842
if (result.IsJust ()) {
2849
2843
return Just (scope.Escape (result.Unwrap ()).As <Promise>());
2850
2844
}
2851
2845
return Nothing<Promise>();
2852
2846
#else
2847
+ Function thenMethod = Get (" then" ).As <Function>();
2848
+ MaybeOrValue<Value> result = thenMethod.Call (*this , {onFulfilled, onRejected});
2853
2849
if (scope.Env ().IsExceptionPending ()) {
2854
2850
return Promise ();
2855
2851
}
@@ -2862,16 +2858,14 @@ inline MaybeOrValue<Promise> Promise::Catch(napi_value onRejected) const {
2862
2858
#ifdef NODE_ADDON_API_ENABLE_MAYBE
2863
2859
MaybeOrValue<Value> catchMethodMaybe = Get (" catch" );
2864
2860
Function catchMethod = catchMethodMaybe.Unwrap ().As <Function>();
2865
- #else
2866
- Function catchMethod = Get (" catch" ).As <Function>();
2867
- #endif
2868
2861
MaybeOrValue<Value> result = catchMethod.Call (*this , {onRejected});
2869
- #ifdef NODE_ADDON_API_ENABLE_MAYBE
2870
2862
if (result.IsJust ()) {
2871
2863
return Just (scope.Escape (result.Unwrap ()).As <Promise>());
2872
2864
}
2873
2865
return Nothing<Promise>();
2874
2866
#else
2867
+ Function catchMethod = Get (" catch" ).As <Function>();
2868
+ MaybeOrValue<Value> result = catchMethod.Call (*this , {onRejected});
2875
2869
if (scope.Env ().IsExceptionPending ()) {
2876
2870
return Promise ();
2877
2871
}
0 commit comments