mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
JS: Add support for index expressions
This commit is contained in:
@@ -130,6 +130,13 @@ module TypeResolution {
|
|||||||
or
|
or
|
||||||
SummaryTypeTracker::basicLoadStep(object.(AST::ValueNode).flow(),
|
SummaryTypeTracker::basicLoadStep(object.(AST::ValueNode).flow(),
|
||||||
member.(AST::ValueNode).flow(), contents)
|
member.(AST::ValueNode).flow(), contents)
|
||||||
|
or
|
||||||
|
exists(IndexExpr index |
|
||||||
|
not exists(index.getPropertyName()) and
|
||||||
|
object = index.getBase() and
|
||||||
|
member = index and
|
||||||
|
contents = DataFlow::ContentSet::arrayElement()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate callTarget(InvokeExpr call, Function target) {
|
predicate callTarget(InvokeExpr call, Function target) {
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import * as express from 'express';
|
||||||
|
|
||||||
|
interface I {
|
||||||
|
[s: string]: express.Request;
|
||||||
|
}
|
||||||
|
function t1(obj: I, x: string) {
|
||||||
|
obj[x]; // $ hasUnderlyingType='express'.Request
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
| globals.ts:1:13:1:14 | el | HTMLElement |
|
| globals.ts:1:13:1:14 | el | HTMLElement |
|
||||||
| globals.ts:6:13:6:14 | el | HTMLInputElement |
|
| globals.ts:6:13:6:14 | el | HTMLInputElement |
|
||||||
| globals.ts:9:13:9:15 | req | Express.Request |
|
| globals.ts:9:13:9:15 | req | Express.Request |
|
||||||
|
| indexExpr.ts:7:5:7:10 | obj[x] | 'express'.Request |
|
||||||
| jsdoc.js:7:13:7:15 | req | 'express'.Request |
|
| jsdoc.js:7:13:7:15 | req | 'express'.Request |
|
||||||
| jsdoc.js:13:13:13:15 | res | 'express'.Response |
|
| jsdoc.js:13:13:13:15 | res | 'express'.Response |
|
||||||
| namedImport.ts:3:13:3:15 | req | 'express'.Request |
|
| namedImport.ts:3:13:3:15 | req | 'express'.Request |
|
||||||
|
|||||||
Reference in New Issue
Block a user