Skip to content

Commit

Permalink
src: replace usage of deprecated Compile
Browse files Browse the repository at this point in the history
PR-URL: #5159
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
targos authored and Ali Sheikh committed Mar 4, 2016
1 parent 79d7475 commit 023c317
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,15 @@ using v8::Integer;
using v8::Isolate;
using v8::Local;
using v8::Locker;
using v8::MaybeLocal;
using v8::Message;
using v8::Number;
using v8::Object;
using v8::ObjectTemplate;
using v8::Promise;
using v8::PromiseRejectMessage;
using v8::PropertyCallbackInfo;
using v8::ScriptOrigin;
using v8::SealHandleScope;
using v8::StackFrame;
using v8::StackTrace;
Expand Down Expand Up @@ -1610,13 +1612,15 @@ static Local<Value> ExecuteString(Environment* env,
// we will handle exceptions ourself.
try_catch.SetVerbose(false);

Local<v8::Script> script = v8::Script::Compile(source, filename);
ScriptOrigin origin(filename);
MaybeLocal<v8::Script> script =
v8::Script::Compile(env->context(), source, &origin);
if (script.IsEmpty()) {
ReportException(env, try_catch);
exit(3);
}

Local<Value> result = script->Run();
Local<Value> result = script.ToLocalChecked()->Run();
if (result.IsEmpty()) {
ReportException(env, try_catch);
exit(4);
Expand Down
9 changes: 4 additions & 5 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ class ContextifyContext {
" }\n"
"})");

Local<String> fname = FIXED_ONE_BYTE_STRING(env()->isolate(),
"binding:script");
Local<Script> script = Script::Compile(code, fname);
Local<Script> script =
Script::Compile(context, code).ToLocalChecked();
clone_property_method = Local<Function>::Cast(script->Run());
CHECK(clone_property_method->IsFunction());
}
Expand Down Expand Up @@ -262,10 +261,10 @@ class ContextifyContext {
}

Context::Scope context_scope(debug_context);
Local<Script> script = Script::Compile(script_source);
MaybeLocal<Script> script = Script::Compile(debug_context, script_source);
if (script.IsEmpty())
return; // Exception pending.
args.GetReturnValue().Set(script->Run());
args.GetReturnValue().Set(script.ToLocalChecked()->Run());
}


Expand Down

0 comments on commit 023c317

Please sign in to comment.