mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
deno2 Simplify Print binding.
This commit is contained in:
parent
f7e99424ee
commit
9df9cdae07
1 changed files with 5 additions and 13 deletions
|
@ -98,20 +98,12 @@ void ExitOnPromiseRejectCallback(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
void Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||||
bool first = true;
|
assert(args.Length() == 1);
|
||||||
auto* isolate = args.GetIsolate();
|
auto* isolate = args.GetIsolate();
|
||||||
for (int i = 0; i < args.Length(); i++) {
|
v8::HandleScope handle_scope(isolate);
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::String::Utf8Value str(isolate, args[0]);
|
||||||
if (first) {
|
const char* cstr = ToCString(str);
|
||||||
first = false;
|
printf("%s\n", cstr);
|
||||||
} else {
|
|
||||||
printf(" ");
|
|
||||||
}
|
|
||||||
v8::String::Utf8Value str(isolate, args[i]);
|
|
||||||
const char* cstr = ToCString(str);
|
|
||||||
printf("%s", cstr);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue