summaryrefslogtreecommitdiff
path: root/src/node_contextify.cc
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2019-04-09 15:21:36 -0700
committerSam Roberts <vieuxtech@gmail.com>2019-04-12 12:33:37 -0700
commit060d901f87b3d87314f8540eb02f315e2952f581 (patch)
tree53159171201703bb6d8a4e780c8624a5c6c8cbb5 /src/node_contextify.cc
parent7b0d8673898e65a368108264c77bccaa3e004028 (diff)
downloadandroid-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.gz
android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.bz2
android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.zip
src: replace FromJust() with Check() when possible
FromJust() is often used not for its return value, but for its side-effects. In these cases, Check() exists, and is more clear as to the intent. From its comment: To be used, where the actual value of the Maybe is not needed, like Object::Set. See: https://github.com/nodejs/node/pull/26929/files#r269256335 PR-URL: https://github.com/nodejs/node/pull/27162 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r--src/node_contextify.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 087727d93a..25b8b28ecd 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -405,7 +405,7 @@ void ContextifyContext::PropertySetterCallback(
args.GetReturnValue().Set(false);
}
- ctx->sandbox()->Set(ctx->context(), property, value).FromJust();
+ ctx->sandbox()->Set(ctx->context(), property, value).Check();
}
// static
@@ -469,7 +469,7 @@ void ContextifyContext::PropertyDefinerCallback(
}
// Set the property on the sandbox.
sandbox->DefineProperty(context, property, *desc_for_sandbox)
- .FromJust();
+ .Check();
};
if (desc.has_get() || desc.has_set()) {
@@ -620,7 +620,7 @@ void ContextifyScript::Init(Environment* env, Local<Object> target) {
env->SetProtoMethod(script_tmpl, "runInThisContext", RunInThisContext);
target->Set(env->context(), class_name,
- script_tmpl->GetFunction(env->context()).ToLocalChecked()).FromJust();
+ script_tmpl->GetFunction(env->context()).ToLocalChecked()).Check();
env->set_script_context_constructor_template(script_tmpl);
}
@@ -744,7 +744,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
args.This()->Set(
env->context(),
env->cached_data_rejected_string(),
- Boolean::New(isolate, source.GetCachedData()->rejected)).FromJust();
+ Boolean::New(isolate, source.GetCachedData()->rejected)).Check();
} else if (produce_cached_data) {
const ScriptCompiler::CachedData* cached_data =
ScriptCompiler::CreateCodeCache(v8_script.ToLocalChecked());
@@ -756,12 +756,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
cached_data->length);
args.This()->Set(env->context(),
env->cached_data_string(),
- buf.ToLocalChecked()).FromJust();
+ buf.ToLocalChecked()).Check();
}
args.This()->Set(
env->context(),
env->cached_data_produced_string(),
- Boolean::New(isolate, cached_data_produced)).FromJust();
+ Boolean::New(isolate, cached_data_produced)).Check();
}
TRACE_EVENT_NESTABLE_ASYNC_END0(
TRACING_CATEGORY_NODE2(vm, script),