Skip to content

Commit

Permalink
fix loops with no body
Browse files Browse the repository at this point in the history
Signed-off-by: Achille Roussel <[email protected]>
  • Loading branch information
achille-roussel committed Sep 19, 2023
1 parent 2c25de1 commit ae25105
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 3 additions & 0 deletions compiler/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func trackDispatchSpans0(stmt ast.Stmt, dispatchSpans map[ast.Stmt]dispatchSpan,
for _, child := range s.List {
nextID = trackDispatchSpans0(child, dispatchSpans, nextID)
}
if len(s.List) == 0 {
nextID++
}
case *ast.IfStmt:
nextID = trackDispatchSpans0(s.Body, dispatchSpans, nextID)
if s.Else != nil {
Expand Down
5 changes: 1 addition & 4 deletions compiler/testdata/coroutine.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,7 @@ func Range10Closure() {
return false
}

for {
if !f() {
break
}
for f() {
}
}

Expand Down
6 changes: 1 addition & 5 deletions compiler/testdata/coroutine_durable.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae25105

Please sign in to comment.