mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: automatic error propagation in place of "or { return(err) }"
This commit is contained in:
@ -39,9 +39,7 @@ pub fn (mut r Readline) read_line_utf8(prompt string) ?ustring {
|
||||
|
||||
// Returns the string from the utf8 ustring
|
||||
pub fn (mut r Readline) read_line(prompt string) ?string {
|
||||
s := r.read_line_utf8(prompt) or {
|
||||
return error(err)
|
||||
}
|
||||
s := r.read_line_utf8(prompt)?
|
||||
return s.s
|
||||
}
|
||||
|
||||
@ -49,9 +47,7 @@ pub fn (mut r Readline) read_line(prompt string) ?string {
|
||||
// Returns utf8 based ustring
|
||||
pub fn read_line_utf8(prompt string) ?ustring {
|
||||
mut r := Readline{}
|
||||
s := r.read_line_utf8(prompt) or {
|
||||
return error(err)
|
||||
}
|
||||
s := r.read_line_utf8(prompt)?
|
||||
return s
|
||||
}
|
||||
|
||||
@ -59,8 +55,6 @@ pub fn read_line_utf8(prompt string) ?ustring {
|
||||
// Return string from utf8 ustring
|
||||
pub fn read_line(prompt string) ?string {
|
||||
mut r := Readline{}
|
||||
s := r.read_line(prompt) or {
|
||||
return error(err)
|
||||
}
|
||||
s := r.read_line(prompt)?
|
||||
return s
|
||||
}
|
||||
|
Reference in New Issue
Block a user