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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user