@@ -189,15 +189,15 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig<Locatio
189189 exists ( SiblingShadowingDecl decl |
190190 scope = decl and
191191 pattern = decl .getPattern ( ) and
192- ( not pattern instanceof Identifier or any ( NameBindingPlugin p ) .isNameDeclaration ( pattern ) ) and
192+ not any ( NameBindingPlugin p ) .isNameReferenceInPatternContext ( pattern ) and
193193 declaration = decl
194194 )
195195 or
196196 exists ( VariableDeclaration decl |
197197 not decl instanceof SiblingShadowingDecl and
198198 getChild ( scope , _) = decl and
199199 pattern = decl .getPattern ( ) and
200- ( not pattern instanceof Identifier or any ( NameBindingPlugin p ) .isNameDeclaration ( pattern ) ) and
200+ not any ( NameBindingPlugin p ) .isNameReferenceInPatternContext ( pattern ) and
201201 declaration = decl
202202 )
203203 or
@@ -210,28 +210,28 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig<Locatio
210210 exists ( Parameter param |
211211 scope = param .getParent ( ) and // TODO: add SourceCallable and use .getParameter() instead
212212 pattern = param .getPattern ( ) and
213- ( not pattern instanceof Identifier or any ( NameBindingPlugin p ) .isNameDeclaration ( pattern ) ) and
213+ not any ( NameBindingPlugin p ) .isNameReferenceInPatternContext ( pattern ) and
214214 declaration = param
215215 )
216216 or
217217 exists ( CatchClause catch |
218218 scope = catch and // ensure both body and pattern are in scope
219219 pattern = catch .getPattern ( ) and
220- ( not pattern instanceof Identifier or any ( NameBindingPlugin p ) .isNameDeclaration ( pattern ) ) and
220+ not any ( NameBindingPlugin p ) .isNameReferenceInPatternContext ( pattern ) and
221221 declaration = catch
222222 )
223223 or
224224 exists ( SwitchCase case |
225225 scope = case and // ensure both body and pattern are in scope
226226 pattern = case .getPattern ( ) and
227- ( not pattern instanceof Identifier or any ( NameBindingPlugin p ) .isNameDeclaration ( pattern ) ) and
227+ not any ( NameBindingPlugin p ) .isNameReferenceInPatternContext ( pattern ) and
228228 declaration = case
229229 )
230230 or
231231 exists ( ForEachStmt stmt |
232232 scope = stmt and // ensure both 'body' and 'guard' are in scope
233233 pattern = stmt .getPattern ( ) and
234- ( not pattern instanceof Identifier or any ( NameBindingPlugin p ) .isNameDeclaration ( pattern ) ) and
234+ not any ( NameBindingPlugin p ) .isNameReferenceInPatternContext ( pattern ) and
235235 declaration = stmt
236236 )
237237 or
@@ -278,7 +278,7 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig<Locatio
278278 )
279279 or
280280 bindingContext ( getEnclosingPatternExpr ( pattern .( Expr ) ) , scope , declaration ) and
281- ( not pattern instanceof Identifier or any ( NameBindingPlugin p ) .isNameDeclaration ( pattern ) )
281+ not any ( NameBindingPlugin p ) .isNameReferenceInPatternContext ( pattern )
282282 }
283283
284284 private Expr getEnclosingPatternExpr ( Expr child ) {
@@ -405,7 +405,6 @@ class PotentialLocalNameAccess extends Identifier {
405405 this instanceof NameDeclaration
406406 or
407407 not this instanceof NameDeclaration and
408- not any ( NameBindingPlugin p ) .isNameDeclaration ( this ) and
409408 not this = any ( NamedPattern p ) .getIdentifier ( ) and
410409 not this = any ( MemberAccessExpr e ) .getMember ( ) and
411410 not this = any ( Argument a ) .getName ( ) and
0 commit comments