JS: Add jsdoc type lookup to definitions.ql

This commit is contained in:
Asger F
2019-07-05 15:34:45 +01:00
parent 197b4d5637
commit e39725114a

View File

@@ -147,7 +147,15 @@ predicate typedInvokeLookup(ASTNode ref, ASTNode decl, string kind) {
)
}
from ASTNode ref, ASTNode decl, string kind
/**
* Holds if `ref` is a JSDoc type annotation referring to a class defined at `decl`.
*/
predicate jsdocTypeLookup(JSDocNamedTypeExpr ref, ASTNode decl, string kind) {
decl = ref.getClass().getAstNode() and
kind = "T"
}
from Locatable ref, ASTNode decl, string kind
where
variableDefLookup(ref, decl, kind)
or
@@ -161,4 +169,6 @@ where
typeLookup(ref, decl, kind)
or
typedInvokeLookup(ref, decl, kind)
or
jsdocTypeLookup(ref, decl, kind)
select ref, decl, kind