Skip to content

Commit 8e16756

Browse files
committed
Implement STR in tools
1 parent a6a5de9 commit 8e16756

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/JavaScriptCallFrame.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ using v8::Function;
1515
using Nan::To;
1616
using Nan::New;
1717
using Nan::Get;
18-
using Nan::Set;
1918
using Nan::SetMethod;
2019
using Nan::EscapableHandleScope;
2120
using Nan::Undefined;
@@ -53,8 +52,8 @@ namespace nodex {
5352
};
5453

5554
NAN_METHOD(JavaScriptCallFrame::EvaluateWithExceptionDetails) {
56-
Local<Object> callFrame = CHK(To<Object>(CHK(Get(info.Holder(), CHK(New("proto"))))));
57-
Local<Function> evalFunction = Local<Function>::Cast(CHK(Get(callFrame, CHK(New("evaluate")))));
55+
Local<Object> callFrame = CHK(To<Object>(CHK(Get(info.Holder(), STR("proto")))));
56+
Local<Function> evalFunction = Local<Function>::Cast(CHK(Get(callFrame, STR("evaluate"))));
5857

5958
Local<Value> expression = info[0];
6059
Local<Value> scopeExtension = info[1];
@@ -82,8 +81,8 @@ namespace nodex {
8281
};
8382

8483
NAN_METHOD(JavaScriptCallFrame::Restart) {
85-
Local<Object> callFrame = CHK(To<Object>(CHK(Get(info.Holder(), CHK(New("proto"))))));
86-
Local<Function> restartFunction = Local<Function>::Cast(CHK(Get(callFrame, CHK(New("restart")))));
84+
Local<Object> callFrame = CHK(To<Object>(CHK(Get(info.Holder(), STR("proto")))));
85+
Local<Function> restartFunction = Local<Function>::Cast(CHK(Get(callFrame, STR("restart"))));
8786

8887
TryCatch tryCatch;
8988
MaybeLocal<Value> result;

src/tools.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#define CHK(VALUE) \
55
VALUE.ToLocalChecked()
66

7+
#define STR(VALUE) \
8+
Nan::New<v8::String>(VALUE).ToLocalChecked()
9+
710
#define RETURN(VALUE) { \
811
info.GetReturnValue().Set(VALUE); \
912
return; \

0 commit comments

Comments
 (0)