@@ -1139,7 +1139,7 @@ static void Stat(const FunctionCallbackInfo<Value>& args) {
11391139
11401140 bool use_bigint = args[1 ]->IsTrue ();
11411141 if (!args[2 ]->IsUndefined ()) { // stat(path, use_bigint, req,
1142- // do_not_throw_if_no_entry )
1142+ // throw_if_no_entry )
11431143 bool do_not_throw_if_no_entry = args[3 ]->IsFalse ();
11441144 FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
11451145 CHECK_NOT_NULL (req_wrap_async);
@@ -1150,25 +1150,14 @@ static void Stat(const FunctionCallbackInfo<Value>& args) {
11501150 path.ToStringView ());
11511151 FS_ASYNC_TRACE_BEGIN1 (
11521152 UV_FS_STAT, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1153- if (do_not_throw_if_no_entry) {
1154- AsyncCall (env,
1155- req_wrap_async,
1156- args,
1157- " stat" ,
1158- UTF8,
1159- AfterStatNoThrowIfNoEntry,
1160- uv_fs_stat,
1161- *path);
1162- } else {
1163- AsyncCall (env,
1164- req_wrap_async,
1165- args,
1166- " stat" ,
1167- UTF8,
1168- AfterStat,
1169- uv_fs_stat,
1170- *path);
1171- }
1153+ AsyncCall (env,
1154+ req_wrap_async,
1155+ args,
1156+ " stat" ,
1157+ UTF8,
1158+ do_not_throw_if_no_entry ? AfterStatNoThrowIfNoEntry : AfterStat,
1159+ uv_fs_stat,
1160+ *path);
11721161 } else { // stat(path, use_bigint, undefined, do_not_throw_if_no_entry)
11731162 THROW_IF_INSUFFICIENT_PERMISSIONS (
11741163 env, permission::PermissionScope::kFileSystemRead , path.ToStringView ());
@@ -1210,7 +1199,9 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
12101199 ToNamespacedPath (env, &path);
12111200
12121201 bool use_bigint = args[1 ]->IsTrue ();
1213- if (!args[2 ]->IsUndefined ()) { // lstat(path, use_bigint, req)
1202+ if (!args[2 ]->IsUndefined ()) { // lstat(path, use_bigint, req,
1203+ // throw_if_no_entry)
1204+ bool do_not_throw_if_no_entry = args[3 ]->IsFalse ();
12141205 FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
12151206 CHECK_NOT_NULL (req_wrap_async);
12161207 FS_ASYNC_TRACE_BEGIN1 (
@@ -1220,7 +1211,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
12201211 args,
12211212 " lstat" ,
12221213 UTF8,
1223- AfterStat,
1214+ do_not_throw_if_no_entry ? AfterStatNoThrowIfNoEntry : AfterStat,
12241215 uv_fs_lstat,
12251216 *path);
12261217 } else { // lstat(path, use_bigint, undefined, throw_if_no_entry)
0 commit comments