mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
jsgen: optional "or blocks" (#6938)
This commit is contained in:
@@ -35,13 +35,13 @@ pub fn eprint(s any) {
|
||||
// a 'real' way to exit in the browser.
|
||||
pub fn exit(c int) {
|
||||
JS.process.exit(c)
|
||||
js_throw('exit($c)')
|
||||
}
|
||||
|
||||
pub fn unwrap(opt any) any {
|
||||
o := &Option(opt)
|
||||
if o.not_ok {
|
||||
panic(o.error)
|
||||
return o.error
|
||||
js_throw(o.error)
|
||||
}
|
||||
return opt
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user