@@ -47,7 +47,7 @@ extension SyntaxProtocol {
4747 for identifier: Identifier ? ,
4848 with config: LookupConfig = LookupConfig ( )
4949 ) -> [ LookupResult ] {
50- scope? . lookup ( for: identifier, at: self , with: config, state : LookupState ( ) ) ?? [ ]
50+ scope? . lookup ( for: identifier, at: self , with: config) ?? [ ]
5151 }
5252}
5353
@@ -59,6 +59,16 @@ extension SyntaxProtocol {
5959 /// Finds all declarations `name` refers to. `syntax` specifies the node lookup was triggered with.
6060 /// If `name` set to `nil`, returns all available names at the given node.
6161 func lookup(
62+ for identifier: Identifier ? ,
63+ at syntax: SyntaxProtocol ,
64+ with config: LookupConfig
65+ ) -> [ LookupResult ]
66+ /// Finds all declarations `name` refers to. `syntax` specifies the node lookup was triggered with.
67+ /// If `name` set to `nil`, returns all available names at the given node.
68+ /// `state` represents lookup state passed between lookup methods.
69+ ///
70+ /// - Note: This method is intended for internal use only. For public usage, use ``ScopeSyntax/lookup(for:at:with:)`` instead.
71+ func _lookup(
6272 for identifier: Identifier ? ,
6373 at syntax: SyntaxProtocol ,
6474 with config: LookupConfig ,
@@ -74,14 +84,28 @@ extension SyntaxProtocol {
7484 /// Returns `LookupResult` of all names introduced in this scope that `name`
7585 /// refers to and is accessible at given syntax node then passes lookup to the parent.
7686 /// If `name` set to `nil`, returns all available names at the given node.
77- @_spi ( Experimental) public func lookup(
87+ /// `state` represents lookup state passed between lookup methods.
88+ ///
89+ /// - Note: This method is intended for internal use only. For public usage, use ``ScopeSyntax/lookup(for:at:with:)`` instead.
90+ @_spi ( Experimental) public func _lookup(
7891 for identifier: Identifier ? ,
7992 at syntax: SyntaxProtocol ,
8093 with config: LookupConfig ,
8194 state: LookupState
8295 ) -> [ LookupResult ] {
8396 defaultLookupImplementation ( for: identifier, at: syntax, with: config, state: state)
8497 }
98+
99+ /// Returns `LookupResult` of all names introduced in this scope that `name`
100+ /// refers to and is accessible at given syntax node then passes lookup to the parent.
101+ /// If `name` set to `nil`, returns all available names at the given node.
102+ @_spi ( Experimental) public func lookup(
103+ for identifier: Identifier ? ,
104+ at syntax: SyntaxProtocol ,
105+ with config: LookupConfig
106+ ) -> [ LookupResult ] {
107+ _lookup ( for: identifier, at: syntax, with: config, state: LookupState ( ) )
108+ }
85109
86110 /// Returns `LookupResult` of all names introduced in this scope that `name`
87111 /// refers to and is accessible at given syntax node then passes lookup to the parent.
@@ -113,7 +137,7 @@ extension SyntaxProtocol {
113137 with config: LookupConfig ,
114138 state: LookupState
115139 ) -> [ LookupResult ] {
116- parentScope? . lookup ( for: identifier, at: syntax, with: config, state: state) ?? [ ]
140+ parentScope? . _lookup ( for: identifier, at: syntax, with: config, state: state) ?? [ ]
117141 }
118142
119143 func checkName( _ name: Identifier ? , refersTo introducedName: LookupName , at syntax: SyntaxProtocol ) -> Bool {
0 commit comments