From 3479f02082178b51d3b41348c1c4744ec189ea25 Mon Sep 17 00:00:00 2001 From: Asger F Date: Mon, 9 Sep 2019 16:29:43 +0100 Subject: [PATCH] JS: Add test showing lack of flow out of inner function --- .../TypeTracking/ClassStyle.expected | 3 +++ .../TypeTracking/PredicateStyle.expected | 3 +++ .../ql/test/library-tests/TypeTracking/tst.js | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/javascript/ql/test/library-tests/TypeTracking/ClassStyle.expected b/javascript/ql/test/library-tests/TypeTracking/ClassStyle.expected index 23368ecc111..65c902de105 100644 --- a/javascript/ql/test/library-tests/TypeTracking/ClassStyle.expected +++ b/javascript/ql/test/library-tests/TypeTracking/ClassStyle.expected @@ -24,6 +24,9 @@ test_Connection | tst.js:63:38:63:77 | api.cha ... ction() | | tst.js:67:14:67:47 | MyAppli ... nection | | tst.js:78:35:78:49 | getConnection() | +| tst.js:80:16:80:19 | conn | +| tst.js:84:22:84:22 | x | +| tst.js:96:7:96:21 | getConnection() | | tst_conflict.js:6:38:6:77 | api.cha ... ction() | test_DataCallback | client.js:3:28:3:34 | x => {} | diff --git a/javascript/ql/test/library-tests/TypeTracking/PredicateStyle.expected b/javascript/ql/test/library-tests/TypeTracking/PredicateStyle.expected index 6f8162cc2dc..321f613fd5b 100644 --- a/javascript/ql/test/library-tests/TypeTracking/PredicateStyle.expected +++ b/javascript/ql/test/library-tests/TypeTracking/PredicateStyle.expected @@ -12,6 +12,8 @@ apiObject connection | type tracker with call steps | tst.js:7:15:7:18 | conn | | type tracker with call steps | tst.js:11:5:11:19 | this.connection | +| type tracker with call steps | tst.js:80:16:80:19 | conn | +| type tracker with call steps | tst.js:84:22:84:22 | x | | type tracker with call steps with property connection | tst.js:7:14:7:13 | this | | type tracker without call steps | client.js:1:10:1:27 | exportedConnection | | type tracker without call steps | tst.js:16:10:16:49 | api.cha ... ction() | @@ -25,6 +27,7 @@ connection | type tracker without call steps | tst.js:63:38:63:77 | api.cha ... ction() | | type tracker without call steps | tst.js:67:14:67:47 | MyAppli ... nection | | type tracker without call steps | tst.js:78:35:78:49 | getConnection() | +| type tracker without call steps | tst.js:96:7:96:21 | getConnection() | | type tracker without call steps | tst_conflict.js:6:38:6:77 | api.cha ... ction() | | type tracker without call steps with property MyApplication.namespace.connection | file://:0:0:0:0 | global access path | | type tracker without call steps with property conflict | tst.js:63:3:63:25 | MyAppli ... mespace | diff --git a/javascript/ql/test/library-tests/TypeTracking/tst.js b/javascript/ql/test/library-tests/TypeTracking/tst.js index e420dfcda0f..530daca87de 100644 --- a/javascript/ql/test/library-tests/TypeTracking/tst.js +++ b/javascript/ql/test/library-tests/TypeTracking/tst.js @@ -76,3 +76,21 @@ function useConnection() { } export const exportedConnection = getConnection(); + +function outer(conn) { + function innerCapture() { + return conn; + } + function innerCall(x) { + return x; + } + + innerCapture(); + innerCall(conn); + innerCall(somethingElse()); + + function otherInner() { + innerCapture(); + } +} +outer(getConnection());