mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler/vlib: add error for no new vars in loop ("_,_") & remove "." from errors
This commit is contained in:

committed by
Alexander Medvednikov

parent
a124d1f0eb
commit
d4bae356ba
@@ -5,7 +5,7 @@
|
||||
module rand
|
||||
|
||||
const (
|
||||
ReadError = error('crypro.rand.read() error reading random bytes.')
|
||||
ReadError = error('crypro.rand.read() error reading random bytes')
|
||||
)
|
||||
|
||||
// NOTE: temp until we have []bytes(buff)
|
||||
|
@@ -12,7 +12,7 @@ const (
|
||||
err_comment_is_delim = error('encoding.csv: comment cannot be the same as delimiter')
|
||||
err_invalid_delim = error('encoding.csv: invalid delimiter')
|
||||
err_eof = error('encoding.csv: end of file')
|
||||
err_invalid_le = error('encoding.csv: could not find any valid line endings.')
|
||||
err_invalid_le = error('encoding.csv: could not find any valid line endings')
|
||||
)
|
||||
|
||||
|
||||
|
@@ -133,7 +133,7 @@ pub fn get_module_filename(handle HANDLE) ?string {
|
||||
return _filename
|
||||
default:
|
||||
// Must handled with GetLastError and converted by FormatMessage
|
||||
return error('Cannot get file name from handle.')
|
||||
return error('Cannot get file name from handle')
|
||||
}
|
||||
}
|
||||
panic('this should be unreachable') // TODO remove unreachable after loop
|
||||
|
@@ -56,7 +56,7 @@ pub fn open(name string, level int, mode string) ?zip_ptr {
|
||||
/* struct zip_t* */_p_zip := zip_ptr(C.zip_open(name.str,
|
||||
_nlevel, mode.str))
|
||||
if _p_zip == zip_ptr(0) {
|
||||
return error('szip: cannot open/create/append new zip archive.')
|
||||
return error('szip: cannot open/create/append new zip archive')
|
||||
}
|
||||
return _p_zip
|
||||
}
|
||||
@@ -130,7 +130,7 @@ pub fn (zentry mut zip_ptr) name() string {
|
||||
pub fn (zentry mut zip_ptr) index() ?int {
|
||||
_index := int(C.zip_entry_index(zentry))
|
||||
if _index == -1 {
|
||||
return error('szip: cannot get current index of zip entry.')
|
||||
return error('szip: cannot get current index of zip entry')
|
||||
}
|
||||
return _index // must be check for INVALID_VALUE
|
||||
}
|
||||
@@ -146,7 +146,7 @@ pub fn (zentry mut zip_ptr) index() ?int {
|
||||
pub fn (zentry mut zip_ptr) isdir() ?bool {
|
||||
_isdir := C.zip_entry_isdir(zentry)
|
||||
if _isdir == -1 {
|
||||
return error('szip: cannot check entry type.')
|
||||
return error('szip: cannot check entry type')
|
||||
}
|
||||
dir := bool(_isdir) // wtf V , unary lvalue
|
||||
return dir
|
||||
@@ -227,7 +227,7 @@ pub fn (zentry mut zip_ptr) read_entry() ?voidptr {
|
||||
mut _bsize := i64(0)
|
||||
res := C.zip_entry_read(zentry, &_buf, &_bsize)
|
||||
if res == -1 {
|
||||
return error('szip: cannot read properly data from entry.')
|
||||
return error('szip: cannot read properly data from entry')
|
||||
}
|
||||
return _buf
|
||||
}
|
||||
@@ -279,7 +279,7 @@ pub fn (zentry mut zip_ptr) extract_entry(path string) /*?*/bool {
|
||||
pub fn (zentry mut zip_ptr) total() ?int {
|
||||
_tentry := int(C.zip_total_entries(zentry))
|
||||
if _tentry == -1 {
|
||||
return error('szip: cannot count total entries.')
|
||||
return error('szip: cannot count total entries')
|
||||
}
|
||||
return _tentry
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ fn (am mut AssetManager) include(asset_type string, combine bool) string {
|
||||
// fn (am mut AssetManager) add(asset_type, file string) ?bool {
|
||||
fn (am mut AssetManager) add(asset_type, file string) bool {
|
||||
if !os.file_exists(file) {
|
||||
// return error('vweb.assets: cannot add asset $file, it does not exist.')
|
||||
// return error('vweb.assets: cannot add asset $file, it does not exist')
|
||||
return false
|
||||
}
|
||||
asset := Asset{
|
||||
|
Reference in New Issue
Block a user