Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #248

Closed
wants to merge 15 commits into from
Prev Previous commit
Next Next commit
deno2 Simplify Print binding.
  • Loading branch information
ry committed Jun 10, 2018
commit 9df9cdae07048564a9d81e9ea67159d49196a1df
18 changes: 5 additions & 13 deletions deno2/deno.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,12 @@ void ExitOnPromiseRejectCallback(
}

void Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
bool first = true;
assert(args.Length() == 1);
auto* isolate = args.GetIsolate();
for (int i = 0; i < args.Length(); i++) {
v8::HandleScope handle_scope(isolate);
if (first) {
first = false;
} else {
printf(" ");
}
v8::String::Utf8Value str(isolate, args[i]);
const char* cstr = ToCString(str);
printf("%s", cstr);
}
printf("\n");
v8::HandleScope handle_scope(isolate);
v8::String::Utf8Value str(isolate, args[0]);
const char* cstr = ToCString(str);
printf("%s\n", cstr);
fflush(stdout);
}

Expand Down