@@ -15,88 +15,6 @@ private import semmle.code.csharp.dataflow.internal.DelegateDataFlow
15
15
private import semmle.code.csharp.frameworks.EntityFramework
16
16
private import FlowSummary
17
17
18
- private newtype TAccessPath =
19
- TNilAccessPath ( ) or
20
- TConsAccessPath ( Content head , AccessPath tail ) {
21
- tail = TNilAccessPath ( )
22
- or
23
- tail = AccessPath:: singleton ( _) and
24
- head instanceof ElementContent
25
- or
26
- tail = AccessPath:: element ( )
27
- }
28
-
29
- /** An access path. */
30
- class AccessPath extends TAccessPath {
31
- /** Gets the head of this access path, if any. */
32
- Content getHead ( ) { this = TConsAccessPath ( result , _) }
33
-
34
- /** Gets the tail of this access path, if any. */
35
- AccessPath getTail ( ) { this = TConsAccessPath ( _, result ) }
36
-
37
- /** Gets the length of this access path. */
38
- int length ( ) {
39
- this = TNilAccessPath ( ) and result = 0
40
- or
41
- result = 1 + this .getTail ( ) .length ( )
42
- }
43
-
44
- /** Gets the access path obtained by dropping the first `i` elements, if any. */
45
- AccessPath drop ( int i ) {
46
- i = 0 and result = this
47
- or
48
- result = this .getTail ( ) .drop ( i - 1 )
49
- }
50
-
51
- /** Holds if this access path contains content `c`. */
52
- predicate contains ( Content c ) { c = this .drop ( _) .getHead ( ) }
53
-
54
- /** Gets a textual representation of this access path. */
55
- string toString ( ) {
56
- exists ( Content head , AccessPath tail |
57
- head = this .getHead ( ) and
58
- tail = this .getTail ( ) and
59
- if tail .length ( ) = 0 then result = head .toString ( ) else result = head + ", " + tail
60
- )
61
- or
62
- this = TNilAccessPath ( ) and
63
- result = "<empty>"
64
- }
65
- }
66
-
67
- /** Provides predicates for constructing access paths. */
68
- module AccessPath {
69
- /** Gets the empty access path. */
70
- AccessPath empty ( ) { result = TNilAccessPath ( ) }
71
-
72
- /** Gets a singleton access path containing `c`. */
73
- AccessPath singleton ( Content c ) { result = TConsAccessPath ( c , TNilAccessPath ( ) ) }
74
-
75
- /** Gets the access path obtained by concatenating `head` onto `tail`. */
76
- AccessPath cons ( Content head , AccessPath tail ) { result = TConsAccessPath ( head , tail ) }
77
-
78
- /** Gets the singleton "element content" access path. */
79
- AccessPath element ( ) { result = singleton ( any ( ElementContent c ) ) }
80
-
81
- /** Gets a singleton property access path. */
82
- AccessPath property ( Property p ) {
83
- result = singleton ( any ( PropertyContent c | c .getProperty ( ) = p .getUnboundDeclaration ( ) ) )
84
- }
85
-
86
- /** Gets a singleton field access path. */
87
- AccessPath field ( Field f ) {
88
- result = singleton ( any ( FieldContent c | c .getField ( ) = f .getUnboundDeclaration ( ) ) )
89
- }
90
-
91
- /** Gets a singleton synthetic field access path. */
92
- AccessPath synthetic ( SyntheticField f ) {
93
- result = singleton ( any ( SyntheticFieldContent c | c .getField ( ) = f ) )
94
- }
95
-
96
- /** Gets an access path representing a property inside a collection. */
97
- AccessPath properties ( Property p ) { result = TConsAccessPath ( any ( ElementContent c ) , property ( p ) ) }
98
- }
99
-
100
18
/** An unbound callable. */
101
19
class SourceDeclarationCallable extends Callable {
102
20
SourceDeclarationCallable ( ) { this .isUnboundDeclaration ( ) }
0 commit comments