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 @@ -68,4 +68,16 @@ module Public {
6868 final class TopLevelStmt extends Stmt {
6969 TopLevelStmt ( ) { this = any ( TopLevel t ) .getBody ( ) .getAStmt ( ) }
7070 }
71+
72+ /** An identifier appearing in the context of an expression, pattern, or type annotation. */
73+ final class IdentifierExpr extends Identifier {
74+ IdentifierExpr ( ) {
75+ not this = any ( MemberAccessExpr e ) .getMemberNameNode ( ) and
76+ not this = any ( Argument a ) .getNameNode ( ) and
77+ not this = any ( Parameter p ) .getExternalNameNode ( ) and
78+ not this = any ( LabeledStmt stmt ) .getLabelNameNode ( ) and
79+ not this = any ( BreakExpr expr ) .getLabelNameNode ( ) and
80+ not this = any ( ContinueExpr expr ) .getLabelNameNode ( )
81+ }
82+ }
7183}
Original file line number Diff line number Diff line change @@ -25,7 +25,11 @@ private module Ast implements AstSig<Location> {
2525
2626 class AstNode = U:: AstNode ;
2727
28- private predicate skipControlFlow ( AstNode e ) { e instanceof Modifier or e instanceof Identifier }
28+ private predicate skipControlFlow ( AstNode e ) {
29+ e instanceof Modifier
30+ or
31+ e instanceof Identifier and not e instanceof IdentifierExpr
32+ }
2933
3034 AstNode getChild ( AstNode n , int index ) {
3135 result .getParent ( ) = n and
Original file line number Diff line number Diff line change @@ -387,16 +387,7 @@ module Public {
387387 * }
388388 * ```
389389 */
390- class PotentialLocalNameAccess extends Identifier {
391- PotentialLocalNameAccess ( ) {
392- not this = any ( MemberAccessExpr e ) .getMemberNameNode ( ) and
393- not this = any ( Argument a ) .getNameNode ( ) and
394- not this = any ( Parameter p ) .getExternalNameNode ( ) and
395- not this = any ( LabeledStmt stmt ) .getLabelNameNode ( ) and
396- not this = any ( BreakExpr expr ) .getLabelNameNode ( ) and
397- not this = any ( ContinueExpr expr ) .getLabelNameNode ( )
398- }
399-
390+ class PotentialLocalNameAccess extends IdentifierExpr {
400391 LocalName getLocalName ( ) { result = this .( LocalNameBindingOutput:: LocalAccess ) .getLocal ( ) }
401392
402393 string getName ( ) { result = this .getValue ( ) }
You can’t perform that action at this time.
0 commit comments