mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
`Isolate::GetCurrent()` should be used instead as it returns the same
thing.
Refs: 5c4a937aaf
PR-URL: https://github.com/nodejs/node/pull/59805
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
25 lines
749 B
C++
25 lines
749 B
C++
#include <node.h>
|
|
#include <v8.h>
|
|
|
|
namespace {
|
|
|
|
inline void NewClass(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
// this != new.target since we are being invoked through super().
|
|
assert(args.IsConstructCall());
|
|
assert(!args.This()->StrictEquals(args.NewTarget()));
|
|
}
|
|
|
|
inline void Initialize(v8::Local<v8::Object> binding) {
|
|
auto isolate = v8::Isolate::GetCurrent();
|
|
auto context = isolate->GetCurrentContext();
|
|
binding->Set(context, v8::String::NewFromUtf8(
|
|
isolate, "Class").ToLocalChecked(),
|
|
v8::FunctionTemplate::New(isolate, NewClass)
|
|
->GetFunction(context)
|
|
.ToLocalChecked()).FromJust();
|
|
}
|
|
|
|
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)
|
|
|
|
} // anonymous namespace
|