@@ -15,7 +15,7 @@ private import Declarations.Declarations
1515 * For example, in the expression `f(x)`, `f` has kind `"M"` while
1616 * `x` has kind `"V"`.
1717 */
18- string refKind ( RefExpr r ) {
18+ private string refKind ( RefExpr r ) {
1919 if exists ( InvokeExpr invk | r = invk .getCallee ( ) .getUnderlyingReference ( ) )
2020 then result = "M"
2121 else result = "V"
@@ -24,7 +24,7 @@ string refKind(RefExpr r) {
2424/**
2525 * Gets a class, function or object literal `va` may refer to.
2626 */
27- ASTNode lookupDef ( VarAccess va ) {
27+ private ASTNode lookupDef ( VarAccess va ) {
2828 exists ( AbstractValue av | av = va .analyze ( ) .getAValue ( ) |
2929 result = av .( AbstractClass ) .getClass ( ) or
3030 result = av .( AbstractFunction ) .getFunction ( ) or
@@ -36,7 +36,7 @@ ASTNode lookupDef(VarAccess va) {
3636 * Holds if `va` is of kind `kind` and `def` is the unique class,
3737 * function or object literal it refers to.
3838 */
39- predicate variableDefLookup ( VarAccess va , ASTNode def , string kind ) {
39+ private predicate variableDefLookup ( VarAccess va , ASTNode def , string kind ) {
4040 count ( lookupDef ( va ) ) = 1 and
4141 def = lookupDef ( va ) and
4242 kind = refKind ( va )
@@ -50,7 +50,7 @@ predicate variableDefLookup(VarAccess va, ASTNode def, string kind) {
5050 * expression of `y` is a variable access `x` of kind `"V"` that refers to
5151 * the declaration `x = 42`.
5252 */
53- predicate variableDeclLookup ( VarAccess va , VarDecl decl , string kind ) {
53+ private predicate variableDeclLookup ( VarAccess va , VarDecl decl , string kind ) {
5454 // restrict to declarations in same file to avoid accidentally picking up
5555 // unrelated global definitions
5656 decl = firstRefInTopLevel ( va .getVariable ( ) , Decl ( ) , va .getTopLevel ( ) ) and
@@ -65,7 +65,7 @@ predicate variableDeclLookup(VarAccess va, VarDecl decl, string kind) {
6565 * For example, in the statement `var a = require("./a")`, the path expression
6666 * `"./a"` imports a module `a` in the same folder.
6767 */
68- predicate importLookup ( ASTNode path , Module target , string kind ) {
68+ private predicate importLookup ( ASTNode path , Module target , string kind ) {
6969 kind = "I" and
7070 (
7171 exists ( Import i |
@@ -83,7 +83,7 @@ predicate importLookup(ASTNode path, Module target, string kind) {
8383/**
8484 * Gets a node that may write the property read by `prn`.
8585 */
86- ASTNode getAWrite ( DataFlow:: PropRead prn ) {
86+ private ASTNode getAWrite ( DataFlow:: PropRead prn ) {
8787 exists ( DataFlow:: AnalyzedNode base , DefiniteAbstractValue baseVal , string propName |
8888 base = prn .getBase ( ) and
8989 propName = prn .getPropertyName ( ) and
@@ -111,7 +111,7 @@ ASTNode getAWrite(DataFlow::PropRead prn) {
111111 * only such property write. Parameter `kind` is always bound to `"M"`
112112 * at the moment.
113113 */
114- predicate propertyLookup ( Expr prop , ASTNode write , string kind ) {
114+ private predicate propertyLookup ( Expr prop , ASTNode write , string kind ) {
115115 exists ( DataFlow:: PropRead prn | prop = prn .getPropertyNameExpr ( ) |
116116 count ( getAWrite ( prn ) ) = 1 and
117117 write = getAWrite ( prn ) and
@@ -122,7 +122,7 @@ predicate propertyLookup(Expr prop, ASTNode write, string kind) {
122122/**
123123 * Holds if `ref` is an identifier that refers to a type declared at `decl`.
124124 */
125- predicate typeLookup ( ASTNode ref , ASTNode decl , string kind ) {
125+ private predicate typeLookup ( ASTNode ref , ASTNode decl , string kind ) {
126126 exists ( TypeAccess typeAccess |
127127 ref = typeAccess .getIdentifier ( ) and
128128 decl = typeAccess .getTypeName ( ) .getADefinition ( ) and
@@ -133,7 +133,7 @@ predicate typeLookup(ASTNode ref, ASTNode decl, string kind) {
133133/**
134134 * Holds if `ref` is the callee name of an invocation of `decl`.
135135 */
136- predicate typedInvokeLookup ( ASTNode ref , ASTNode decl , string kind ) {
136+ private predicate typedInvokeLookup ( ASTNode ref , ASTNode decl , string kind ) {
137137 not variableDefLookup ( ref , decl , _) and
138138 not propertyLookup ( ref , decl , _) and
139139 exists ( InvokeExpr invoke , Expr callee |
@@ -147,7 +147,7 @@ predicate typedInvokeLookup(ASTNode ref, ASTNode decl, string kind) {
147147/**
148148 * Holds if `ref` is a JSDoc type annotation referring to a class defined at `decl`.
149149 */
150- predicate jsdocTypeLookup ( JSDocNamedTypeExpr ref , ASTNode decl , string kind ) {
150+ private predicate jsdocTypeLookup ( JSDocNamedTypeExpr ref , ASTNode decl , string kind ) {
151151 decl = ref .getClass ( ) .getAstNode ( ) and
152152 kind = "T"
153153}
0 commit comments