Skip to content

Commit b9434c9

Browse files
committed
fix scope on compiling while loop
1 parent c577b77 commit b9434c9

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

go/_test/while.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ for b {
33
for {
44
var x = 1
55
}
6+
for {
7+
var x = 1
8+
}

go/_test/while.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ endwhile
33
while 1
44
let x = 1
55
endwhile
6+
while 1
7+
let x = 1
8+
endwhile

go/gocompiler.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,9 @@ function s:GoCompiler.compile_while(node)
561561
endif
562562
call self.out('for %s{', cond)
563563
call self.incindent("\t")
564+
call self.inscope()
564565
call self.compile_body(a:node.body)
566+
call self.descope()
565567
call self.decindent()
566568
call self.out('}')
567569
endfunction

go/vimlparser.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)