mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
JS: add Parameter.getJSDocTag
This commit is contained in:
@@ -29,6 +29,8 @@ class ExprOrType extends @exprortype, Documentable {
|
||||
not exists(getOwnDocumentation()) and
|
||||
if getParent() instanceof Property
|
||||
then result = getParent().(Property).getDocumentation()
|
||||
else if getParent() instanceof MethodDeclaration
|
||||
then result = getParent().(MethodDeclaration).getDocumentation()
|
||||
else result = getEnclosingStmt().getDocumentation()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -585,6 +585,13 @@ class Parameter extends BindingPattern {
|
||||
int getNumDecorator() { result = count(getADecorator()) }
|
||||
|
||||
override predicate isLValue() { any() }
|
||||
|
||||
/**
|
||||
* Gets the JSDoc tag describing this parameter, if any.
|
||||
*/
|
||||
JSDocTag getJSDocTag() {
|
||||
none() // overridden in SimpleParameter
|
||||
}
|
||||
}
|
||||
|
||||
/** A parameter declaration that is not an object or array pattern. */
|
||||
@@ -601,6 +608,15 @@ class SimpleParameter extends Parameter, VarDecl {
|
||||
result = ssa.getVariable().getAUse()
|
||||
)
|
||||
}
|
||||
|
||||
override JSDocTag getJSDocTag() {
|
||||
exists(Function fun |
|
||||
this = fun.getAParameter() and
|
||||
result = fun.getDocumentation().getATag() and
|
||||
result.getTitle() = "param" and
|
||||
result.getName() = getName()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user