File tree Expand file tree Collapse file tree
unified/ql/lib/codeql/unified/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig<Locatio
184184 override AstNode getElse ( ) { none ( ) }
185185 }
186186
187- private predicate bindingContext ( AstNode pattern , AstNode scope ) {
187+ additional predicate bindingContext ( AstNode pattern , AstNode scope ) {
188188 exists ( SiblingShadowingDecl decl |
189189 scope = decl and
190190 pattern = decl .getPattern ( )
@@ -345,11 +345,13 @@ class PotentialLocalNameAccess extends Identifier {
345345 or
346346 this = any ( NamedTypeExpr e | not exists ( e .getQualifier ( ) ) ) .getName ( )
347347 or
348- this = any ( FunctionDeclaration f ) .getName ( )
349- // TODO: include other declaration kinds here
348+ LocalNameBindingInput:: bindingContext ( this , _)
350349 }
351350
352351 LocalName getLocalName ( ) { result = this .( LocalNameBindingOutput:: LocalAccess ) .getLocal ( ) }
353352
354353 string getName ( ) { result = this .getValue ( ) }
354+
355+ /** Holds if this is one of the declaration sites for a name, such as the `x` in `let x = 123`. */
356+ predicate isDeclarationSite ( ) { LocalNameBindingInput:: bindingContext ( this , _) }
355357}
You can’t perform that action at this time.
0 commit comments