Files
node/test/addons/new-target/binding.cc
Michaël Zasso 5623194a6b doc,src,test: replace use of deprecated GetIsolate
`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>
2025-10-04 18:48:35 +02:00

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