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 {
5151
5252 /// Given syntax node position, returns all available labeled statements.
5353 func lookupLabeledStmts( at syntax: SyntaxProtocol ) -> [ LabeledStmtSyntax ] {
54- return lookupLabeledStmtsHelper ( at: syntax. parent, accumulator : [ ] )
54+ return lookupLabeledStmtsHelper ( at: syntax. parent)
5555 }
5656
5757 /// 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 [ ] }
6060 if let labeledStmtSyntax = syntax. as ( LabeledStmtSyntax . self) {
61- return lookupLabeledStmtsHelper ( at: labeledStmtSyntax. parent, accumulator : accumulator + [ labeledStmtSyntax ] )
61+ return [ labeledStmtSyntax ] + lookupLabeledStmtsHelper( at: labeledStmtSyntax. parent)
6262 } else {
63- return lookupLabeledStmtsHelper ( at: syntax. parent, accumulator : accumulator )
63+ return lookupLabeledStmtsHelper ( at: syntax. parent)
6464 }
6565 }
6666
You can’t perform that action at this time.
0 commit comments