-
Notifications
You must be signed in to change notification settings - Fork 0
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
Code And Learn 2018 #1
Comments
About the C++ tasks ( IntroductionPreviously v8 only has C++ APIs to
So for example to create a JS array of length 2 with known elements Local<Array> arr = Array::New(isolate);
arr->Set(context, 0, some_value).FromJust();
arr->Set(context, 1, another_value).FromJust(); This is conceptually equivalent to JS code: const arr = [];
arr[0] = some_value;
arr[1] = another_value; Now there is a new API added in v8 that allows you to convert a C Local<Value> values[] = { some_value, another_value };
// arraysize is a convenience template defined in node_internals.h
Local<Array> arr = Array::New(isolate, values, arraysize(values)); This can also be used to convert the values in a contiguous container e.g. std::vector<Local<Value>> values;
// ....some code pushes a bunch of Local<Value> into the vector
Local<Array> arr = Array::New(isolate, values.data(), values.size()); The task is:
ExampleFor more background, see nodejs#24125 diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index c40b855b99..93c1035617 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -50,11 +50,12 @@ void SetupNextTick(const FunctionCallbackInfo<Value>& args) {
.ToLocalChecked();
run_microtasks_fn->SetName(FIXED_ONE_BYTE_STRING(isolate, "runMicrotasks"));
- Local<Array> ret = Array::New(isolate, 2);
- ret->Set(context, 0, env->tick_info()->fields().GetJSArray()).FromJust();
- ret->Set(context, 1, run_microtasks_fn).FromJust();
+ Local<Value> ret[] = {
+ env->tick_info()->fields().GetJSArray(),
+ run_microtasks_fn
+ };
- args.GetReturnValue().Set(ret);
+ args.GetReturnValue().Set(Array::New(isolate, ret, arraysize(ret)));
}
void PromiseRejectCallback(PromiseRejectMessage message) { |
List of solved issues:
|
|
Switched the order of arguments for strictEqual checks inside of test/paralell/test-http2-binding.js PR-URL: nodejs#24616 Refs: nodejsjp#1 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Switched the order of arguments for strictEqual checks inside of test/paralell/test-http2-binding.js PR-URL: #24616 Refs: nodejsjp#1 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Switched the order of arguments for strictEqual checks inside of test/paralell/test-http2-binding.js PR-URL: #24616 Refs: nodejsjp#1 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Switched the order of arguments for strictEqual checks inside of test/paralell/test-http2-binding.js PR-URL: nodejs#24616 Refs: nodejsjp#1 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Switched the order of arguments for strictEqual checks inside of test/paralell/test-http2-binding.js PR-URL: #24616 Refs: nodejsjp#1 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Switched the order of arguments for strictEqual checks inside of test/paralell/test-http2-binding.js PR-URL: #24616 Refs: nodejsjp#1 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
[lib]: Convert to Arrow Function
[src]: deprecated V8 API migration (ref)
[test]: assert.strictEqual (ref)
[docs]: replace anonymous function with arrow function (ref)
[docs]: typo
Others
Let’s rename all error arguments in documentation to err
The text was updated successfully, but these errors were encountered: