JS: Make getDocumentation handle chain assignments

This commit is contained in:
Asger F
2019-08-27 13:16:31 +01:00
parent 61034be186
commit 89b91af6db
3 changed files with 23 additions and 1 deletions

View File

@@ -55,6 +55,14 @@ class ExprOrType extends @exprortype, Documentable {
exists(DotExpr dot | this = dot.getProperty() |
result = dot.getDocumentation()
)
or
exists(AssignExpr e | this = e.getRhs() |
result = e.getDocumentation()
)
or
exists(ParExpr p | this = p.getExpression() |
result = p.getDocumentation()
)
)
}

View File

@@ -1,2 +1,4 @@
| tst.js:4:4:4:9 | @param | @param tag refers to non-existent parameter prameter. |
| tst.js:12:4:12:9 | @param | @param tag refers to non-existent parameter sign. |
| tst.js:51:4:51:9 | @param | @param tag refers to non-existent parameter opts. |
| tst.js:57:4:57:9 | @param | @param tag refers to non-existent parameter opts. |

View File

@@ -45,4 +45,16 @@ function good3() {
lastName = arguments[0];
}
return firstName + sep + lastName;
}
}
/**
* @param {IncomingMessage} opts
*/
var Cookie = foo.bar = function Cookie(options) {
}
/**
* @param {IncomingMessage} opts
*/
Cookie2 = foo.bar2 = function Cookie2(options) {
}