Try new Run #2

This commit is contained in:
Luis Blanco 2018-11-29 10:52:18 +03:00
parent 88ee8720d5
commit f09dddceb0
1 changed files with 9 additions and 6 deletions

View File

@ -332,9 +332,11 @@ private:
V8_VAR_STR code = JS_STR( V8_VAR_STR code = JS_STR(
"(new Error()).stack.split('\\n').slice(2).join('\\n')" "(new Error()).stack.split('\\n').slice(2).join('\\n')"
); );
V8_VAR_STR stack = V8_VAR_STR::Cast(
v8::Script::Compile(code)->Run(Nan::GetCurrentContext()) V8_VAR_STR stack = v8::Script::Compile(code)->Run(
); Nan::GetCurrentContext()
).As<v8::String>()->Value();
Nan::Utf8String stackStr(stack); Nan::Utf8String stackStr(stack);
msg += *stackStr; msg += *stackStr;
@ -437,9 +439,10 @@ private:
}) })
)"); )");
V8_VAR_FUNC decor = V8_VAR_FUNC::Cast( V8_VAR_FUNC decor = v8::Script::Compile(code)->Run(
v8::Script::Compile(code)->Run(Nan::GetCurrentContext()) Nan::GetCurrentContext()
); ).As<v8::Function>()->Value();
Nan::Callback decorCb(decor); Nan::Callback decorCb(decor);
V8_VAR_VAL argv[] = { info.This(), info[0], raw }; V8_VAR_VAL argv[] = { info.This(), info[0], raw };
Nan::AsyncResource async("EventEmitter::js_once()"); Nan::AsyncResource async("EventEmitter::js_once()");