mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: fix warning at comptime call (#8248)
This commit is contained in:
parent
0d204603d1
commit
6b1956fb60
@ -3605,6 +3605,11 @@ fn (mut c Checker) comptime_call(mut node ast.ComptimeCall) table.Type {
|
||||
if node.method_name == 'html' {
|
||||
return c.table.find_type_idx('vweb.Result')
|
||||
}
|
||||
mut var := c.fn_scope.objects[node.method_name]
|
||||
if mut var is ast.Var {
|
||||
var.is_used = true
|
||||
c.fn_scope.objects[node.method_name] = var
|
||||
}
|
||||
return table.string_type
|
||||
}
|
||||
|
||||
|
1
vlib/v/checker/tests/comptime_call_no_unused_var.out
Normal file
1
vlib/v/checker/tests/comptime_call_no_unused_var.out
Normal file
@ -0,0 +1 @@
|
||||
|
11
vlib/v/checker/tests/comptime_call_no_unused_var.vv
Normal file
11
vlib/v/checker/tests/comptime_call_no_unused_var.vv
Normal file
@ -0,0 +1,11 @@
|
||||
struct Test {}
|
||||
|
||||
fn (test Test) print() {
|
||||
println('test')
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test := Test{}
|
||||
abc := 'print'
|
||||
test.$abc()
|
||||
}
|
Loading…
Reference in New Issue
Block a user