Skip to content

Commit 059860a

Browse files
committed
Break early from sequential for loop when over lookup origin position.
1 parent 5461b07 commit 059860a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/SwiftLexicalLookup/SequentialScopeSyntax.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ extension SequentialScopeSyntax {
6464
}
6565

6666
for codeBlockItem in itemsWithoutNamedDecl {
67+
guard codeBlockItem.position < origin.position else { break }
68+
6769
if let introducingToParentScope = Syntax(codeBlockItem.item).asProtocol(SyntaxProtocol.self)
6870
as? IntroducingToSequentialParentScopeSyntax
6971
{

0 commit comments

Comments
 (0)