We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8d2101c + 85de4e1 commit a6387e0Copy full SHA for a6387e0
internal/runtime/compiler/ast/ast.go
@@ -435,14 +435,15 @@ func (n *StopStmt) Type() types.Type {
435
436
// mergepositionlist is a helper that merges the positions of all the nodes in a list.
437
func mergepositionlist(l []Node) *position.Position {
438
- if len(l) == 0 {
+ switch len(l) {
439
+ case 0:
440
return nil
- }
441
- if len(l) == 1 {
442
- if l[0] != nil {
443
- return l[0].Pos()
+ case 1:
+ if l[0] == nil {
+ return nil
444
}
445
- return nil
+ return l[0].Pos()
446
+ default:
447
+ return position.Merge(l[0].Pos(), mergepositionlist(l[1:]))
448
- return position.Merge(l[0].Pos(), mergepositionlist(l[1:]))
449
0 commit comments