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

v.gen.js: fix method calls and other codegen parts, rand module compiles (#11205)

This commit is contained in:
playX
2021-08-18 11:33:37 +03:00
committed by GitHub
parent c51f83efba
commit 0121c8b4fd
9 changed files with 301 additions and 130 deletions

View File

@@ -6,34 +6,6 @@ module builtin
fn (a any) toString()
pub fn println(s any) {
// Quickfix to properly print basic types
// TODO: Add proper detection code for this
JS.console.log(s.toString())
}
pub fn print(s any) {
// TODO
// $if js.node {
JS.process.stdout.write(s.toString())
// } $else {
// panic('Cannot `print` in a browser, use `println` instead')
// }
}
pub fn eprintln(s any) {
JS.console.error(s.toString())
}
pub fn eprint(s any) {
// TODO
// $if js.node {
JS.process.stderr.write(s.toString())
// } $else {
// panic('Cannot `eprint` in a browser, use `eprintln` instead')
// }
}
// Exits the process in node, and halts execution in the browser
// because `process.exit` is undefined. Workaround for not having
// a 'real' way to exit in the browser.