File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Sources/SwiftLexicalScopes Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -51,16 +51,16 @@ extension Scope {
51
51
52
52
/// Given syntax node position, returns all available labeled statements.
53
53
func lookupLabeledStmts( at syntax: SyntaxProtocol ) -> [ LabeledStmtSyntax ] {
54
- return lookupLabeledStmtsHelper ( at: syntax. parent, accumulator : [ ] )
54
+ return lookupLabeledStmtsHelper ( at: syntax. parent)
55
55
}
56
56
57
57
/// Helper method to recursively collect labeled statements from the syntax node's parents.
58
- private func lookupLabeledStmtsHelper( at syntax: Syntax ? , accumulator : [ LabeledStmtSyntax ] ) -> [ LabeledStmtSyntax ] {
59
- guard let syntax, !syntax. is ( MemberBlockSyntax . self) else { return accumulator }
58
+ private func lookupLabeledStmtsHelper( at syntax: Syntax ? ) -> [ LabeledStmtSyntax ] {
59
+ guard let syntax, !syntax. is ( MemberBlockSyntax . self) else { return [ ] }
60
60
if let labeledStmtSyntax = syntax. as ( LabeledStmtSyntax . self) {
61
- return lookupLabeledStmtsHelper ( at: labeledStmtSyntax. parent, accumulator : accumulator + [ labeledStmtSyntax ] )
61
+ return [ labeledStmtSyntax ] + lookupLabeledStmtsHelper( at: labeledStmtSyntax. parent)
62
62
} else {
63
- return lookupLabeledStmtsHelper ( at: syntax. parent, accumulator : accumulator )
63
+ return lookupLabeledStmtsHelper ( at: syntax. parent)
64
64
}
65
65
}
66
66
You can’t perform that action at this time.
0 commit comments