parser: smartcast fix (#5756)

pull/5723/head
Daniel Däschle 2020-07-08 16:08:44 +02:00 committed by GitHub
parent f834276803
commit e7cd496c31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -129,9 +129,9 @@ fn (mut p Parser) vweb() ast.ComptimeCall {
// copy vars from current fn scope into vweb_tmpl scope
for stmt in file.stmts {
if stmt is ast.FnDecl {
fn_decl := stmt as ast.FnDecl
if fn_decl.name == 'main.vweb_tmpl_$p.cur_fn_name' {
tmpl_scope := file.scope.innermost(fn_decl.body_pos.pos)
if it.name == 'main.vweb_tmpl_$p.cur_fn_name' {
fn_decl := it
tmpl_scope := file.scope.innermost(it.body_pos.pos)
for _, obj in p.scope.objects {
if obj is ast.Var {
mut v := it