1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v: make js hello world work

This commit is contained in:
Abdullah Atta
2020-05-21 18:17:16 +05:00
committed by GitHub
parent a9999ee10d
commit 9888bacad5
13 changed files with 70 additions and 836 deletions

View File

@@ -4,32 +4,13 @@
module builtin
pub fn exit(code int) {
println('js.exit()')
}
// isnil returns true if an object is nil (only for C objects).
pub fn isnil(v voidptr) bool {
return v == 0
}
pub fn panic(s string) {
eprintln('V panic: ' + s)
exit(1)
}
fn JS.console.log(arg ...string)
fn JS.process.stdout.write(arg string)
pub fn println(s string) {
#console.log(s.str)
}
pub fn eprintln(s string) {
#console.error(s)
JS.console.log(s)
}
pub fn print(s string) {
#console.log(s)
}
JS.process.stdout.write(s)
}