From: Oguz Bastemur Date: Wed, 30 Sep 2015 05:02:12 +0000 (+0200) Subject: contextify: use CHECK instead of `if` X-Git-Tag: v4.1.2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5615854ea81a18e3aca7b03b52b9f6d73657d84;p=platform%2Fupstream%2Fnodejs.git contextify: use CHECK instead of `if` I was walking through the vm changes and saw this particular `if` check interesting. In case `ctx` is empty it's going to fail later anyways. So, instead of putting an `if` check there; option a - use CHECK option b - do nothing Considering the developer wanted to make sure `ctx` is not empty, `CHECK` option looked more convenient. PR-URL: https://github.com/nodejs/node/pull/3125 Reviewed-By: Ben Noordhuis --- diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 6520355..8880439 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -216,8 +216,9 @@ class ContextifyContext { object_template->SetHandler(config); Local ctx = Context::New(env->isolate(), nullptr, object_template); - if (!ctx.IsEmpty()) - ctx->SetSecurityToken(env->context()->GetSecurityToken()); + + CHECK(!ctx.IsEmpty()); + ctx->SetSecurityToken(env->context()->GetSecurityToken()); env->AssignToContext(ctx);