mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
JS: Add type-tracking test
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| summarize.js:30:14:30:26 | // track: obj | Failed to track obj here. |
|
||||
| summarize.js:33:14:33:26 | // track: obj | Failed to track obj here. |
|
||||
|
||||
33
javascript/ql/test/library-tests/TypeTracking/summarize.js
Normal file
33
javascript/ql/test/library-tests/TypeTracking/summarize.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'dummy';
|
||||
|
||||
function identity(x) {
|
||||
return x;
|
||||
}
|
||||
function load(x) {
|
||||
return x.loadProp;
|
||||
}
|
||||
function store(x) {
|
||||
return { storeProp: x };
|
||||
}
|
||||
function loadStore(x) {
|
||||
return { storeProp: x.loadProp };
|
||||
}
|
||||
|
||||
identity({});
|
||||
load({});
|
||||
store({});
|
||||
loadStore({});
|
||||
|
||||
const obj = {}; // name: obj
|
||||
|
||||
let x = identity(obj);
|
||||
x; // track: obj
|
||||
|
||||
x = load({ loadProp: obj });
|
||||
x; // track: obj
|
||||
|
||||
x = store(obj);
|
||||
x.storeProp; // track: obj
|
||||
|
||||
x = loadStore({ loadProp: obj });
|
||||
x.storeProp; // track: obj
|
||||
Reference in New Issue
Block a user