mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: don't show manual memory warning twice (#15510)
This commit is contained in:
parent
6ff753745f
commit
0d8b6ee7f2
@ -1165,10 +1165,6 @@ pub fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type {
|
|||||||
return ast.int_type
|
return ast.int_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !c.is_builtin_mod && !c.inside_unsafe && method_name == 'free' {
|
|
||||||
c.warn('manual memory management with `free()` is only allowed in unsafe code',
|
|
||||||
node.pos)
|
|
||||||
}
|
|
||||||
if left_type == ast.void_type {
|
if left_type == ast.void_type {
|
||||||
// No need to print this error, since this means that the variable is unknown,
|
// No need to print this error, since this means that the variable is unknown,
|
||||||
// and there already was an error before.
|
// and there already was an error before.
|
||||||
@ -1602,6 +1598,10 @@ pub fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type {
|
|||||||
c.fail_if_unreadable(node.left, left_type, 'receiver')
|
c.fail_if_unreadable(node.left, left_type, 'receiver')
|
||||||
return ast.string_type
|
return ast.string_type
|
||||||
} else if method_name == 'free' {
|
} else if method_name == 'free' {
|
||||||
|
if !c.is_builtin_mod && !c.inside_unsafe && !method.is_unsafe {
|
||||||
|
c.warn('manual memory management with `free()` is only allowed in unsafe code',
|
||||||
|
node.pos)
|
||||||
|
}
|
||||||
return ast.void_type
|
return ast.void_type
|
||||||
}
|
}
|
||||||
// call struct field fn type
|
// call struct field fn type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user