Skip to content

Commit

Permalink
chore: simplify assert implemention by calling args.rval().setUndefin…
Browse files Browse the repository at this point in the history
…ed() once
  • Loading branch information
JakeChampion committed May 11, 2023
1 parent 3d4b76c commit 43ef438
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions runtime/js-compute-runtime/builtins/shared/console.cpp
Expand Up @@ -443,10 +443,10 @@ static bool console_out(JSContext *cx, unsigned argc, JS::Value *vp) {
// assert(condition, ...data)
static bool assert(JSContext *cx, unsigned argc, JS::Value *vp) {
JS::CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setUndefined();
auto condition = args.get(0).toBoolean();
// 1. If condition is true, return.
if (!condition) {
args.rval().setUndefined();
return true;
}

Expand Down Expand Up @@ -486,8 +486,6 @@ static bool assert(JSContext *cx, unsigned argc, JS::Value *vp) {

// 5. Perform Logger("assert", data).
builtin_impl_console_log(Console::LogType::Error, message.c_str());

args.rval().setUndefined();
return true;
}

Expand Down

0 comments on commit 43ef438

Please sign in to comment.