Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: migrate to new V8 array API #24613

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src: refactor src/node_util.cc
Use static sized data structure
  • Loading branch information
kt3k committed Nov 28, 2018
commit 3729328ffe25f767b5e69d4393d06ef5142d2176
10 changes: 4 additions & 6 deletions src/node_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ static void GetPromiseDetails(const FunctionCallbackInfo<Value>& args) {
Local<Promise> promise = args[0].As<Promise>();

int state = promise->State();
std::vector<Local<Value>> values(2);
values.push_back(Integer::New(isolate, state));
Local<Value> values[2] = { Integer::New(isolate, state) };
size_t number_of_values = 1;
if (state != Promise::PromiseState::kPending)
values.push_back(promise->Result());

Local<Array> ret = Array::New(
isolate, values.data(), values.size());
values[number_of_values++] = promise->Result();
Local<Array> ret = Array::New(isolate, values, number_of_values);
args.GetReturnValue().Set(ret);
}

Expand Down