checker/tests: format test added in prev commit & rename chekcer prop
parent
8dc2601080
commit
e1c8b07fa5
|
@ -124,7 +124,7 @@ mut:
|
|||
inside_println_arg bool
|
||||
inside_decl_rhs bool
|
||||
inside_if_guard bool // true inside the guard condition of `if x := opt() {}`
|
||||
vweb_comptime_call_pos int // needed for correctly checking use before decl for vweb templates
|
||||
comptime_call_pos int // needed for correctly checking use before decl for templates
|
||||
}
|
||||
|
||||
pub fn new_checker(table &ast.Table, pref &pref.Preferences) &Checker {
|
||||
|
@ -3109,7 +3109,7 @@ pub fn (mut c Checker) ident(mut node ast.Ident) ast.Type {
|
|||
// if the variable is declared before the comptime call then we can assume all is well.
|
||||
// `node.name !in node.scope.objects` checks it's an inherited var (not defined in the tmpl).
|
||||
node_pos := if c.pref.is_vweb && node.name !in node.scope.objects {
|
||||
c.vweb_comptime_call_pos
|
||||
c.comptime_call_pos
|
||||
} else {
|
||||
node.pos.pos
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ fn (mut c Checker) comptime_call(mut node ast.ComptimeCall) ast.Type {
|
|||
is_vweb: true
|
||||
}
|
||||
mut c2 := new_checker(c.table, pref2)
|
||||
c2.vweb_comptime_call_pos = node.pos.pos
|
||||
c2.comptime_call_pos = node.pos.pos
|
||||
c2.check(node.vweb_tmpl)
|
||||
c.warnings << c2.warnings
|
||||
c.errors << c2.errors
|
||||
|
|
|
@ -3,9 +3,11 @@ struct MyHeapStruct {
|
|||
name string
|
||||
}
|
||||
|
||||
// make sure dereferencing of heap stucts works in selector expr (in tmpl),
|
||||
// make sure dereferencing of heap stucts works in selector expr (in tmpl),
|
||||
fn test_heap_struct_dereferencing_in_selector_expr() {
|
||||
a := MyHeapStruct{name: 'my_heap_struct_a'}
|
||||
a := MyHeapStruct{
|
||||
name: 'my_heap_struct_a'
|
||||
}
|
||||
b := 2
|
||||
$tmpl('comptime_call_tmpl_variable_scope_test.tpl')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue