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

os: clean up file functions, use optionals

This commit is contained in:
Alexander Medvednikov
2019-07-03 21:07:42 +02:00
parent ffb4da791d
commit dec0d961f5
8 changed files with 107 additions and 64 deletions

View File

@ -32,6 +32,7 @@ fn new_scanner(file_path string) *Scanner {
if !os.file_exists(file_path) {
panic('"$file_path" doesn\'t exist')
}
//text := os.read_file(file_path)
text := os.read_file(file_path) or {
panic('scanner: failed to open "$file_path"')
return &Scanner{}