Skip to content

Commit 53688c7

Browse files
committed
UUse NaN to construct the TargetRegistryWrapper
Signed-off-by: Vihan <vihan+github@vihan.org>
1 parent 6ae946a commit 53688c7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/support/target-registry.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ NAN_METHOD(TargetRegistryWrapper::lookupTarget) {
2424
NAN_MODULE_INIT(TargetRegistryWrapper::Init) {
2525
v8::Local<v8::ObjectTemplate> tpl = Nan::New<v8::ObjectTemplate>();
2626
Nan::SetMethod(tpl, "lookupTarget", TargetRegistryWrapper::lookupTarget);
27-
28-
Nan::Set(target, Nan::New("TargetRegistry").ToLocalChecked(), tpl->NewInstance());
27+
28+
auto targetRegistry = Nan::NewInstance(targetRegistry).ToLocalChecked();
29+
30+
Nan::Set(target, Nan::New("TargetRegistry").ToLocalChecked(), targetRegistry);
2931
}
3032

3133
//--------------------------------------------------------------

src/support/target-registry.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88

99
class TargetRegistryWrapper: public Nan::ObjectWrap, public FromValueMixin<TargetRegistryWrapper> {
1010
public:
11-
1211
static NAN_MODULE_INIT(Init);
1312

1413
private:
15-
static NAN_METHOD(lookupTarget);
14+
static NAN_METHOD(lookupTarget);
1615

17-
TargetRegistryWrapper() = delete;
16+
TargetRegistryWrapper() = delete;
1817
};
1918

2019
class TargetWrapper: public Nan::ObjectWrap, public FromValueMixin<TargetWrapper> {
@@ -35,4 +34,4 @@ class TargetWrapper: public Nan::ObjectWrap, public FromValueMixin<TargetWrapper
3534
static Nan::Persistent<v8::ObjectTemplate> target_template;
3635
};
3736

38-
#endif
37+
#endif

0 commit comments

Comments
 (0)