@@ -2811,6 +2811,8 @@ inline void Promise::CheckCast(napi_env env, napi_value value) {
2811
2811
NAPI_CHECK (result, " Promise::CheckCast" , " value is not promise" );
2812
2812
}
2813
2813
2814
+ inline Promise::Promise () : Object () {}
2815
+
2814
2816
inline Promise::Promise (napi_env env, napi_value value) : Object (env, value) {}
2815
2817
2816
2818
inline MaybeOrValue<Promise> Promise::Then (napi_value onFulfilled) const {
@@ -2820,7 +2822,8 @@ inline MaybeOrValue<Promise> Promise::Then(napi_value onFulfilled) const {
2820
2822
if (!Get (" then" ).UnwrapTo (&thenMethod)) {
2821
2823
return Nothing<Promise>();
2822
2824
}
2823
- MaybeOrValue<Value> result = thenMethod.As <Function>().Call (*this , {onFulfilled});
2825
+ MaybeOrValue<Value> result =
2826
+ thenMethod.As <Function>().Call (*this , {onFulfilled});
2824
2827
if (result.IsJust ()) {
2825
2828
return Just (scope.Escape (result.Unwrap ()).As <Promise>());
2826
2829
}
@@ -2835,21 +2838,24 @@ inline MaybeOrValue<Promise> Promise::Then(napi_value onFulfilled) const {
2835
2838
#endif
2836
2839
}
2837
2840
2838
- inline MaybeOrValue<Promise> Promise::Then (napi_value onFulfilled, napi_value onRejected) const {
2841
+ inline MaybeOrValue<Promise> Promise::Then (napi_value onFulfilled,
2842
+ napi_value onRejected) const {
2839
2843
EscapableHandleScope scope (_env);
2840
2844
#ifdef NODE_ADDON_API_ENABLE_MAYBE
2841
2845
Value thenMethod;
2842
2846
if (!Get (" then" ).UnwrapTo (&thenMethod)) {
2843
2847
return Nothing<Promise>();
2844
2848
}
2845
- MaybeOrValue<Value> result = thenMethod.As <Function>().Call (*this , {onFulfilled, onRejected});
2849
+ MaybeOrValue<Value> result =
2850
+ thenMethod.As <Function>().Call (*this , {onFulfilled, onRejected});
2846
2851
if (result.IsJust ()) {
2847
2852
return Just (scope.Escape (result.Unwrap ()).As <Promise>());
2848
2853
}
2849
2854
return Nothing<Promise>();
2850
2855
#else
2851
2856
Function thenMethod = Get (" then" ).As <Function>();
2852
- MaybeOrValue<Value> result = thenMethod.Call (*this , {onFulfilled, onRejected});
2857
+ MaybeOrValue<Value> result =
2858
+ thenMethod.Call (*this , {onFulfilled, onRejected});
2853
2859
if (scope.Env ().IsExceptionPending ()) {
2854
2860
return Promise ();
2855
2861
}
@@ -2864,7 +2870,8 @@ inline MaybeOrValue<Promise> Promise::Catch(napi_value onRejected) const {
2864
2870
if (!Get (" catch" ).UnwrapTo (&catchMethod)) {
2865
2871
return Nothing<Promise>();
2866
2872
}
2867
- MaybeOrValue<Value> result = catchMethod.As <Function>().Call (*this , {onRejected});
2873
+ MaybeOrValue<Value> result =
2874
+ catchMethod.As <Function>().Call (*this , {onRejected});
2868
2875
if (result.IsJust ()) {
2869
2876
return Just (scope.Escape (result.Unwrap ()).As <Promise>());
2870
2877
}
@@ -2883,8 +2890,10 @@ inline MaybeOrValue<Promise> Promise::Then(const Function& onFulfilled) const {
2883
2890
return Then (static_cast <napi_value>(onFulfilled));
2884
2891
}
2885
2892
2886
- inline MaybeOrValue<Promise> Promise::Then (const Function& onFulfilled, const Function& onRejected) const {
2887
- return Then (static_cast <napi_value>(onFulfilled), static_cast <napi_value>(onRejected));
2893
+ inline MaybeOrValue<Promise> Promise::Then (const Function& onFulfilled,
2894
+ const Function& onRejected) const {
2895
+ return Then (static_cast <napi_value>(onFulfilled),
2896
+ static_cast <napi_value>(onRejected));
2888
2897
}
2889
2898
2890
2899
inline MaybeOrValue<Promise> Promise::Catch (const Function& onRejected) const {
0 commit comments