File tree Expand file tree Collapse file tree
test/library-tests/GlobalAccessPaths Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -444,7 +444,7 @@ module AccessPath {
444444 ref = getAccessTo ( root , path , _) and
445445 ref .getBasicBlock ( ) = bb
446446 |
447- ref order by any ( int i | ref .asExpr ( ) = bb .getNode ( i ) )
447+ ref order by any ( int i | ref .asExpr ( ) . getEnclosingStmt ( ) = bb .getNode ( i ) )
448448 ) and
449449 result = getAccessTo ( root , path , type )
450450 }
Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ test_getAReferenceTo
6161| test.js:39:14:39:16 | foo | foo |
6262| test.js:39:14:39:20 | foo.bar | foo.bar |
6363| test.js:40:3:40:10 | lazyInit | foo.bar |
64+ | test.js:44:13:44:18 | Object | Object |
65+ | test.js:44:13:44:25 | Object.create | Object.create |
66+ | test.js:50:7:50:12 | random | random |
67+ | test.js:56:7:56:12 | random | random |
6468test_getAnAssignmentTo
6569| other_ns.js:4:9:4:16 | NS \|\| {} | NS |
6670| other_ns.js:6:12:6:13 | {} | Conflict |
@@ -71,9 +75,14 @@ test_getAnAssignmentTo
7175| test.js:30:1:30:28 | functio ... on() {} | globalFunction |
7276| test.js:32:1:35:1 | functio ... .baz'\\n} | destruct |
7377| test.js:37:1:41:1 | functio ... Init;\\n} | lazy |
78+ | test.js:43:1:61:1 | functio ... // no\\n} | dominatingWrite |
7479test_assignedUnique
7580| GlobalClass |
7681| destruct |
82+ | dominatingWrite |
7783| f |
7884| globalFunction |
7985| lazy |
86+ hasDominatingWrite
87+ | test.js:48:3:48:11 | obj.prop1 |
88+ | test.js:57:5:57:13 | obj.prop3 |
Original file line number Diff line number Diff line change @@ -9,3 +9,7 @@ query string test_getAnAssignmentTo(DataFlow::Node node) {
99}
1010
1111query string test_assignedUnique ( ) { AccessPath:: isAssignedInUniqueFile ( result ) }
12+
13+ query DataFlow:: PropRead hasDominatingWrite ( ) {
14+ AccessPath:: DominatingPaths:: hasDominatingWrite ( result )
15+ }
Original file line number Diff line number Diff line change @@ -39,3 +39,23 @@ function lazy() {
3939 lazyInit = foo . bar ; // 'foo.bar'
4040 lazyInit ;
4141}
42+
43+ function dominatingWrite ( ) {
44+ var obj = Object . create ( ) ;
45+
46+ obj . prop1 ; // no
47+ obj . prop1 = "foo" ;
48+ obj . prop1 ; // yes
49+
50+ if ( random ( ) ) {
51+ obj . prop2 = "foo" ;
52+ }
53+ obj . prop2 ; // no
54+
55+ obj . prop3 = "foo" ;
56+ if ( random ( ) ) {
57+ obj . prop3 ; // yes
58+ }
59+
60+ obj . prop4 = obj . prop4 ; // no
61+ }
You can’t perform that action at this time.
0 commit comments