File tree Expand file tree Collapse file tree 4 files changed +34
-1
lines changed
test/library-tests/GlobalAccessPaths Expand file tree Collapse file tree 4 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -444,7 +444,7 @@ module AccessPath {
444
444
ref = getAccessTo ( root , path , _) and
445
445
ref .getBasicBlock ( ) = bb
446
446
|
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 ) )
448
448
) and
449
449
result = getAccessTo ( root , path , type )
450
450
}
Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ test_getAReferenceTo
61
61
| test.js:39:14:39:16 | foo | foo |
62
62
| test.js:39:14:39:20 | foo.bar | foo.bar |
63
63
| 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 |
64
68
test_getAnAssignmentTo
65
69
| other_ns.js:4:9:4:16 | NS \|\| {} | NS |
66
70
| other_ns.js:6:12:6:13 | {} | Conflict |
@@ -71,9 +75,14 @@ test_getAnAssignmentTo
71
75
| test.js:30:1:30:28 | functio ... on() {} | globalFunction |
72
76
| test.js:32:1:35:1 | functio ... .baz'\\n} | destruct |
73
77
| test.js:37:1:41:1 | functio ... Init;\\n} | lazy |
78
+ | test.js:43:1:61:1 | functio ... // no\\n} | dominatingWrite |
74
79
test_assignedUnique
75
80
| GlobalClass |
76
81
| destruct |
82
+ | dominatingWrite |
77
83
| f |
78
84
| globalFunction |
79
85
| 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) {
9
9
}
10
10
11
11
query 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() {
39
39
lazyInit = foo . bar ; // 'foo.bar'
40
40
lazyInit ;
41
41
}
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