mirror of
https://github.com/vlang/v.git
synced 2025-09-14 23:12:33 +03:00
js: implement more functions for JS backend (#12167)
This commit is contained in:
parent
ade5774313
commit
d373eba79b
7 changed files with 134 additions and 3 deletions
|
@ -2,8 +2,11 @@ module builtin
|
|||
|
||||
// used to generate JS throw statements.
|
||||
|
||||
[noreturn]
|
||||
pub fn js_throw(s any) {
|
||||
#throw s
|
||||
|
||||
for {}
|
||||
}
|
||||
|
||||
#let globalPrint;
|
||||
|
@ -46,6 +49,7 @@ pub fn eprint(s string) {
|
|||
// 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.
|
||||
[noreturn]
|
||||
pub fn exit(c int) {
|
||||
JS.process.exit(c)
|
||||
js_throw('exit($c)')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue