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

parser: deprecate size_t (#11443)

This commit is contained in:
Enzo
2021-09-08 12:09:32 +02:00
committed by GitHub
parent 892971024e
commit e3b65092d6
31 changed files with 160 additions and 152 deletions

View File

@@ -498,6 +498,13 @@ pub fn (mut p Parser) find_type_or_add_placeholder(name string, language ast.Lan
// struct / enum / placeholder
mut idx := p.table.find_type_idx(name)
if idx > 0 {
if idx == ast.size_t_type_idx {
// don't warn in builtin, there is still the `.str` method
if !p.pref.is_fmt && !p.builtin_mod {
p.warn_with_pos('`size_t` is deprecated, use `usize` instead', p.prev_tok.position())
}
return ast.new_type(ast.usize_type_idx)
}
return ast.new_type(idx)
}
// not found - add placeholder