mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
checker: vfmt fn.v
This commit is contained in:
parent
a20fff99e0
commit
78f34e6c89
@ -10,7 +10,7 @@ const text_size = 16
|
|||||||
struct App {
|
struct App {
|
||||||
mut:
|
mut:
|
||||||
gg &gg.Context = unsafe { nil }
|
gg &gg.Context = unsafe { nil }
|
||||||
dropped_file_list []string = []string{}
|
dropped_file_list []string
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -1766,10 +1766,11 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
|
|||||||
// bug with fn...
|
// bug with fn...
|
||||||
// fn f(p &Foo) => f(foo) -- do not allow this, force f(&foo)
|
// fn f(p &Foo) => f(foo) -- do not allow this, force f(&foo)
|
||||||
// if !c.is_builtin_mod
|
// if !c.is_builtin_mod
|
||||||
if param.typ == ast.voidptr_type && func.language == .v
|
else if param.typ == ast.voidptr_type && func.language == .v
|
||||||
&& arg_typ !in [ast.voidptr_type, ast.nil_type] && arg_typ.nr_muls() == 0
|
&& arg_typ !in [ast.voidptr_type, ast.nil_type] && arg_typ.nr_muls() == 0
|
||||||
&& func.name !in ['isnil', 'ptr_str'] && !func.name.starts_with('json.')
|
&& func.name !in ['isnil', 'ptr_str'] && !func.name.starts_with('json.')
|
||||||
&& arg_typ_sym.kind !in [.float_literal, .int_literal] && !c.pref.backend.is_js() {
|
&& arg_typ_sym.kind !in [.float_literal, .int_literal, .charptr]
|
||||||
|
&& !c.pref.backend.is_js() {
|
||||||
c.warn('automatic ${arg_typ_sym.name} referencing/dereferencing into voidptr is deprecated and will be removed soon; use `foo(&x)` instead of `foo(x)`',
|
c.warn('automatic ${arg_typ_sym.name} referencing/dereferencing into voidptr is deprecated and will be removed soon; use `foo(&x)` instead of `foo(x)`',
|
||||||
call_arg.pos)
|
call_arg.pos)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user