@@ -47,7 +47,7 @@ extension SyntaxProtocol {
47
47
for identifier: Identifier ? ,
48
48
with config: LookupConfig = LookupConfig ( )
49
49
) -> [ LookupResult ] {
50
- scope? . lookup ( for: identifier, at: self , with: config, state : LookupState ( ) ) ?? [ ]
50
+ scope? . lookup ( for: identifier, at: self , with: config) ?? [ ]
51
51
}
52
52
}
53
53
@@ -59,6 +59,16 @@ extension SyntaxProtocol {
59
59
/// Finds all declarations `name` refers to. `syntax` specifies the node lookup was triggered with.
60
60
/// If `name` set to `nil`, returns all available names at the given node.
61
61
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(
62
72
for identifier: Identifier ? ,
63
73
at syntax: SyntaxProtocol ,
64
74
with config: LookupConfig ,
@@ -74,14 +84,28 @@ extension SyntaxProtocol {
74
84
/// Returns `LookupResult` of all names introduced in this scope that `name`
75
85
/// refers to and is accessible at given syntax node then passes lookup to the parent.
76
86
/// 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(
78
91
for identifier: Identifier ? ,
79
92
at syntax: SyntaxProtocol ,
80
93
with config: LookupConfig ,
81
94
state: LookupState
82
95
) -> [ LookupResult ] {
83
96
defaultLookupImplementation ( for: identifier, at: syntax, with: config, state: state)
84
97
}
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
+ }
85
109
86
110
/// Returns `LookupResult` of all names introduced in this scope that `name`
87
111
/// refers to and is accessible at given syntax node then passes lookup to the parent.
@@ -113,7 +137,7 @@ extension SyntaxProtocol {
113
137
with config: LookupConfig ,
114
138
state: LookupState
115
139
) -> [ LookupResult ] {
116
- parentScope? . lookup ( for: identifier, at: syntax, with: config, state: state) ?? [ ]
140
+ parentScope? . _lookup ( for: identifier, at: syntax, with: config, state: state) ?? [ ]
117
141
}
118
142
119
143
func checkName( _ name: Identifier ? , refersTo introducedName: LookupName , at syntax: SyntaxProtocol ) -> Bool {
0 commit comments