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

checker: check option fn returning error (fix #17423) (#17438)

This commit is contained in:
yuyi
2023-03-02 21:49:50 +08:00
committed by GitHub
parent 8f7c35552d
commit 17000ef7b6
49 changed files with 129 additions and 106 deletions

View File

@ -3,7 +3,7 @@ module regex
import strings
// compile_opt compile RE pattern string
pub fn (mut re RE) compile_opt(pattern string) ? {
pub fn (mut re RE) compile_opt(pattern string) ! {
re_err, err_pos := re.impl_compile(pattern)
if re_err != compile_ok {
@ -34,7 +34,7 @@ pub fn new() RE {
}
// regex_opt create new RE object from RE pattern string
pub fn regex_opt(pattern string) ?RE {
pub fn regex_opt(pattern string) !RE {
// init regex
mut re := RE{}
re.prog = []Token{len: pattern.len + 1} // max program length, can not be longer then the pattern
@ -47,7 +47,7 @@ pub fn regex_opt(pattern string) ?RE {
re.group_data = []int{len: re.group_max, init: -1}
// compile the pattern
re.compile_opt(pattern)?
re.compile_opt(pattern)!
return re
}