Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e397251

Browse files
committed
JS: Add jsdoc type lookup to definitions.ql
1 parent 197b4d5 commit e397251

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

javascript/ql/src/definitions.ql

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ predicate typedInvokeLookup(ASTNode ref, ASTNode decl, string kind) {
147147
)
148148
}
149149

150-
from ASTNode ref, ASTNode decl, string kind
150+
/**
151+
* Holds if `ref` is a JSDoc type annotation referring to a class defined at `decl`.
152+
*/
153+
predicate jsdocTypeLookup(JSDocNamedTypeExpr ref, ASTNode decl, string kind) {
154+
decl = ref.getClass().getAstNode() and
155+
kind = "T"
156+
}
157+
158+
from Locatable ref, ASTNode decl, string kind
151159
where
152160
variableDefLookup(ref, decl, kind)
153161
or
@@ -161,4 +169,6 @@ where
161169
typeLookup(ref, decl, kind)
162170
or
163171
typedInvokeLookup(ref, decl, kind)
172+
or
173+
jsdocTypeLookup(ref, decl, kind)
164174
select ref, decl, kind

0 commit comments

Comments
 (0)