parser: minor cleanup of `parse_block_no_scope()` (#7644)

pull/7633/head
yuyi 2020-12-28 17:58:44 +08:00 committed by GitHub
parent 64c0645bcb
commit dea3d0431d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -364,15 +364,15 @@ pub fn (mut p Parser) parse_block_no_scope(is_top_level bool) []ast.Stmt {
p.check(.lcbr)
mut stmts := []ast.Stmt{}
if p.tok.kind != .rcbr {
mut c := 0
mut count := 0
for p.tok.kind !in [.eof, .rcbr] {
stmts << p.stmt(is_top_level)
c++
if c % 100000 == 0 {
eprintln('parsed $c statements so far from fn $p.cur_fn_name ...')
count++
if count % 100000 == 0 {
eprintln('parsed $count statements so far from fn $p.cur_fn_name ...')
}
if c > 1000000 {
p.error_with_pos('parsed over $c statements from fn $p.cur_fn_name, the parser is probably stuck',
if count > 1000000 {
p.error_with_pos('parsed over $count statements from fn $p.cur_fn_name, the parser is probably stuck',
p.tok.position())
return []
}