File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
src/semmle/javascript/dataflow/internal
test/library-tests/ThisExpr Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,19 @@ private class AnalyzedThisInBoundFunction extends AnalyzedThisExpr {
4545 }
4646}
4747
48+ /**
49+ * Flow analysis for `this` expressions in node modules.
50+ *
51+ * These expressions are assumed to refer to the `module.exports` object.
52+ */
53+ private class AnalyzedThisAsModuleExports extends DataFlow:: AnalyzedNode , DataFlow:: ThisNode {
54+ NodeModule m ;
55+
56+ AnalyzedThisAsModuleExports ( ) { m = getBindingContainer ( ) }
57+
58+ override AbstractValue getALocalValue ( ) { result = TAbstractExportsObject ( m ) }
59+ }
60+
4861/**
4962 * Flow analysis for `this` expressions inside a function that is instantiated.
5063 *
Original file line number Diff line number Diff line change 11| module-exports.js:3:1:3:4 | this | file://:0:0:0:0 | indefinite value (call) |
2+ | module-exports.js:3:1:3:4 | this | module-exports.js:1:1:8:0 | exports object of module module-exports |
23| module-exports.js:4:28:4:31 | this | file://:0:0:0:0 | indefinite value (call) |
34| module-exports.js:4:28:4:31 | this | module-exports.js:1:1:8:0 | exports object of module module-exports |
45| module-exports.js:4:28:4:31 | this | module-exports.js:4:15:4:34 | instance of anonymous function |
78| module-exports.js:5:35:5:38 | this | module-exports.js:1:1:8:0 | exports object of module module-exports |
89| module-exports.js:5:35:5:38 | this | module-exports.js:5:22:5:41 | instance of anonymous function |
910| module-exports.js:6:21:6:24 | this | file://:0:0:0:0 | indefinite value (call) |
11+ | module-exports.js:6:21:6:24 | this | module-exports.js:1:1:8:0 | exports object of module module-exports |
1012| module-exports.js:7:28:7:31 | this | file://:0:0:0:0 | indefinite value (call) |
13+ | module-exports.js:7:28:7:31 | this | module-exports.js:1:1:8:0 | exports object of module module-exports |
1114| tst.js:4:9:4:12 | this | file://:0:0:0:0 | indefinite value (call) |
1215| tst.js:4:9:4:12 | this | tst.js:1:1:11:1 | instance of class C_normal |
1316| tst.js:8:15:8:18 | this | file://:0:0:0:0 | indefinite value (call) |
You can’t perform that action at this time.
0 commit comments