mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 09:46:56 +08:00
Properly handle infinite for loops when next'ing
This commit is contained in:
@ -191,8 +191,17 @@ func (s *Searcher) parseDefaultBlock(ifRoot ast.Node, parsedFile *ast.File, line
|
||||
}
|
||||
|
||||
if stmt, ok := n.(*ast.ForStmt); ok {
|
||||
parents = append(parents, stmt.Body)
|
||||
pos := s.fileset.Position(stmt.Pos())
|
||||
if stmt.Cond == nil {
|
||||
nextLine := s.fileset.Position(stmt.Body.List[0].Pos()).Line
|
||||
if line < nextLine {
|
||||
lines = []int{nextLine}
|
||||
found = true
|
||||
parents = nil
|
||||
return false
|
||||
}
|
||||
}
|
||||
parents = append(parents, stmt.Body)
|
||||
parentBlockBeginLine = pos.Line
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user