parser: minor cleanup of `parse_block_no_scope()` (#7644)
							parent
							
								
									64c0645bcb
								
							
						
					
					
						commit
						dea3d0431d
					
				|  | @ -364,15 +364,15 @@ pub fn (mut p Parser) parse_block_no_scope(is_top_level bool) []ast.Stmt { | ||||||
| 	p.check(.lcbr) | 	p.check(.lcbr) | ||||||
| 	mut stmts := []ast.Stmt{} | 	mut stmts := []ast.Stmt{} | ||||||
| 	if p.tok.kind != .rcbr { | 	if p.tok.kind != .rcbr { | ||||||
| 		mut c := 0 | 		mut count := 0 | ||||||
| 		for p.tok.kind !in [.eof, .rcbr] { | 		for p.tok.kind !in [.eof, .rcbr] { | ||||||
| 			stmts << p.stmt(is_top_level) | 			stmts << p.stmt(is_top_level) | ||||||
| 			c++ | 			count++ | ||||||
| 			if c % 100000 == 0 { | 			if count % 100000 == 0 { | ||||||
| 				eprintln('parsed $c statements so far from fn $p.cur_fn_name ...') | 				eprintln('parsed $count statements so far from fn $p.cur_fn_name ...') | ||||||
| 			} | 			} | ||||||
| 			if c > 1000000 { | 			if count > 1000000 { | ||||||
| 				p.error_with_pos('parsed over $c statements from fn $p.cur_fn_name, the parser is probably stuck', | 				p.error_with_pos('parsed over $count statements from fn $p.cur_fn_name, the parser is probably stuck', | ||||||
| 					p.tok.position()) | 					p.tok.position()) | ||||||
| 				return [] | 				return [] | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue