Skip to content

Commit a00c922

Browse files
committed
Limit access of LiexicalScope lookup methods
1 parent 211cb6f commit a00c922

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Sources/SwiftLexicalScopes/LexicalScopes.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ import SwiftSyntax
1515

1616
public enum LexicalScopes {
1717
/// Given syntax node position, returns all available labeled statements.
18-
public static func lookupLabeledStmts(at syntax: SyntaxProtocol) -> [LabeledStmtSyntax] {
18+
@_spi(Compiler) @_spi(Testing) public static func lookupLabeledStmts(at syntax: SyntaxProtocol) -> [LabeledStmtSyntax] {
1919
guard let scope = syntax.scope else { return [] }
2020
return scope.lookupLabeledStmts(at: syntax)
2121
}
2222

2323
/// Given syntax node position, returns the current switch case and it's fallthrough destination.
24-
public static func lookupFallthroughSourceAndDest(
24+
@_spi(Compiler) @_spi(Testing) public static func lookupFallthroughSourceAndDest(
2525
at syntax: SyntaxProtocol
2626
) -> (source: SwitchCaseSyntax?, destination: SwitchCaseSyntax?) {
2727
guard let scope = syntax.scope else { return (nil, nil) }
2828
return scope.lookupFallthroughSourceAndDestination(at: syntax)
2929
}
3030

3131
/// Given syntax node position, returns the closest ancestor catch node.
32-
public static func lookupCatchNode(at syntax: SyntaxProtocol) -> Syntax? {
32+
@_spi(Compiler) @_spi(Testing) public static func lookupCatchNode(at syntax: SyntaxProtocol) -> Syntax? {
3333
guard let scope = syntax.scope else { return nil }
3434
return scope.lookupCatchNode(at: Syntax(syntax))
3535
}
3636

3737
/// Given name and syntax node position, return referenced declaration.
38-
public static func lookupDeclarationFor(name: String, at syntax: SyntaxProtocol) -> Syntax? {
38+
@_spi(Compiler) @_spi(Testing) public static func lookupDeclarationFor(name: String, at syntax: SyntaxProtocol) -> Syntax? {
3939
guard let scope = syntax.scope else { return nil }
4040
return scope.getDeclarationFor(name: name, at: syntax)
4141
}

Tests/SwiftLexicalScopesTest/Assertions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Foundation
14-
import SwiftLexicalScopes
14+
@_spi(Testing) import SwiftLexicalScopes
1515
import SwiftParser
1616
import SwiftSyntax
1717
import XCTest

Tests/SwiftLexicalScopesTest/SimpleQueryTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Foundation
14-
import SwiftLexicalScopes
14+
@_spi(Testing) import SwiftLexicalScopes
1515
import XCTest
1616

1717
final class testSimpleQueries: XCTestCase {

0 commit comments

Comments
 (0)