Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 814126c

Browse filesBrowse files
RaisinTentargos
authored andcommitted
src,fs: remove ToLocalChecked() call from fs::AfterMkdirp()
This merges the `IsEmpty()` call and the `ToLocalChecked()` call into a single `ToLocal()` call. Signed-off-by: Darshan Sen <darshan.sen@postman.com> PR-URL: #40386 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 5a588ff commit 814126c
Copy full SHA for 814126c

File tree

Expand file treeCollapse file tree

1 file changed

+11
-16
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-16
lines changed
Open diff view settings
Collapse file

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+11-16Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -714,24 +714,19 @@ void FromNamespacedPath(std::string* path) {
714714
void AfterMkdirp(uv_fs_t* req) {
715715
FSReqBase* req_wrap = FSReqBase::from_req(req);
716716
FSReqAfterScope after(req_wrap, req);
717-
718-
MaybeLocal<Value> path;
719-
Local<Value> error;
720-
721717
if (after.Proceed()) {
722-
if (!req_wrap->continuation_data()->first_path().empty()) {
723-
std::string first_path(req_wrap->continuation_data()->first_path());
724-
FromNamespacedPath(&first_path);
725-
path = StringBytes::Encode(req_wrap->env()->isolate(), first_path.c_str(),
726-
req_wrap->encoding(),
727-
&error);
728-
if (path.IsEmpty())
729-
req_wrap->Reject(error);
730-
else
731-
req_wrap->Resolve(path.ToLocalChecked());
732-
} else {
733-
req_wrap->Resolve(Undefined(req_wrap->env()->isolate()));
718+
std::string first_path(req_wrap->continuation_data()->first_path());
719+
if (first_path.empty())
720+
return req_wrap->Resolve(Undefined(req_wrap->env()->isolate()));
721+
FromNamespacedPath(&first_path);
722+
Local<Value> path;
723+
Local<Value> error;
724+
if (!StringBytes::Encode(req_wrap->env()->isolate(), first_path.c_str(),
725+
req_wrap->encoding(),
726+
&error).ToLocal(&path)) {
727+
return req_wrap->Reject(error);
734728
}
729+
return req_wrap->Resolve(path);
735730
}
736731
}
737732

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.