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

checker: make missing mut before an argument a warning

This commit is contained in:
Alexander Medvednikov 2020-12-02 23:58:06 +01:00
parent 4b94c29c91
commit 1037d3a383

View File

@ -1294,7 +1294,7 @@ pub fn (mut c Checker) call_method(mut call_expr ast.CallExpr) table.Type {
} else {
if param.is_mut && (!arg.is_mut || param.typ.share() != arg.share) {
tok := arg.share.str()
c.error('`$call_expr.name` parameter `$param.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i +
c.warn('`$call_expr.name` parameter `$param.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i +
1}`', arg.expr.position())
}
}
@ -1566,7 +1566,7 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
} else {
if arg.is_mut && (!call_arg.is_mut || arg.typ.share() != call_arg.share) {
tok := call_arg.share.str()
c.error('`$call_expr.name` parameter `$arg.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i +
c.warn('`$call_expr.name` parameter `$arg.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i +
1}`', call_arg.expr.position())
}
}