mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
JS: Add JSDoc test
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
test_isString
|
||||
| string |
|
||||
test_isNumber
|
||||
| number |
|
||||
test_QualifiedName
|
||||
| VarType | VarType |
|
||||
| boolean | boolean |
|
||||
| foo.bar.baz | foo.bar.baz |
|
||||
| number | number |
|
||||
| string | string |
|
||||
test_ParameterType
|
||||
| tst.js:7:12:7:12 | x | string |
|
||||
| tst.js:7:15:7:15 | y | number? |
|
||||
| tst.js:7:18:7:18 | z | foo.bar.baz |
|
||||
test_VarType
|
||||
| tst.js:7:12:7:12 | x | string |
|
||||
| tst.js:7:15:7:15 | y | number? |
|
||||
| tst.js:7:18:7:18 | z | foo.bar.baz |
|
||||
| tst.js:11:7:11:7 | w | VarType |
|
||||
test_ReturnType
|
||||
| tst.js:7:1:12:1 | functio ... null;\\n} | boolean |
|
||||
@@ -0,0 +1,25 @@
|
||||
import javascript
|
||||
|
||||
query TypeAnnotation test_isString() {
|
||||
result.isString()
|
||||
}
|
||||
|
||||
query TypeAnnotation test_isNumber() {
|
||||
result.isNumber()
|
||||
}
|
||||
|
||||
query TypeAnnotation test_QualifiedName(string name) {
|
||||
result.hasQualifiedName(name)
|
||||
}
|
||||
|
||||
query TypeAnnotation test_ParameterType(Parameter p) {
|
||||
result = p.getTypeAnnotation()
|
||||
}
|
||||
|
||||
query TypeAnnotation test_VarType(VarDecl decl) {
|
||||
result = decl.getTypeAnnotation()
|
||||
}
|
||||
|
||||
query TypeAnnotation test_ReturnType(Function f) {
|
||||
result = f.getReturnTypeAnnotation()
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @param {string} x
|
||||
* @param {number?} y
|
||||
* @param {foo.bar.baz} z
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function f(x, y, z) {
|
||||
/**
|
||||
* @type {VarType}
|
||||
*/
|
||||
var w = null;
|
||||
}
|
||||
Reference in New Issue
Block a user