builtin: fix compilation (#11445)

pull/11446/head
Enzo 2021-09-08 13:19:21 +02:00 committed by GitHub
parent 43fae5de74
commit bef3390f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -23,9 +23,9 @@ pub fn (x usize) str() string {
return u64(x).str()
}
pub fn (x size_t) str() string {
return u64(x).str()
}
// pub fn (x size_t) str() string {
// return u64(x).str()
// }
pub fn (cptr &char) str() string {
return u64(cptr).hex()

View File

@ -498,9 +498,9 @@ 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 {
if !p.builtin_mod && 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 {
if !p.pref.is_fmt {
p.warn_with_pos('`size_t` is deprecated, use `usize` instead', p.prev_tok.position())
}
return ast.new_type(ast.usize_type_idx)