Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reformat ast mergepositionlist because gosec is buggy #890

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions internal/runtime/compiler/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,15 @@

// mergepositionlist is a helper that merges the positions of all the nodes in a list.
func mergepositionlist(l []Node) *position.Position {
if len(l) == 0 {
switch len(l) {
case 0:
return nil
}
if len(l) == 1 {
if l[0] != nil {
return l[0].Pos()
case 1:
if l[0] == nil {
Dismissed Show dismissed Hide dismissed
return nil
}
return nil
return l[0].Pos()
Dismissed Show dismissed Hide dismissed
default:
return position.Merge(l[0].Pos(), mergepositionlist(l[1:]))
Dismissed Show dismissed Hide dismissed
Dismissed Show dismissed Hide dismissed
}
return position.Merge(l[0].Pos(), mergepositionlist(l[1:]))
}
Loading