@@ -56,15 +56,30 @@ predicate summaryElement(
56
56
)
57
57
}
58
58
59
+ bindingset [ arg]
60
+ private SummaryComponent interpretElementArg ( string arg ) {
61
+ arg = "?" and
62
+ result = FlowSummary:: SummaryComponent:: elementUnknown ( )
63
+ or
64
+ arg = "any" and
65
+ result = FlowSummary:: SummaryComponent:: elementAny ( )
66
+ or
67
+ exists ( ConstantValue cv | result = FlowSummary:: SummaryComponent:: elementKnown ( cv ) |
68
+ cv .isInt ( AccessPath:: parseInt ( arg ) )
69
+ or
70
+ not exists ( AccessPath:: parseInt ( arg ) ) and
71
+ cv .serialize ( ) = arg
72
+ )
73
+ }
74
+
59
75
/**
60
76
* Gets the summary component for specification component `c`, if any.
61
77
*
62
78
* This covers all the Ruby-specific components of a flow summary.
63
79
*/
64
80
SummaryComponent interpretComponentSpecific ( AccessPathToken c ) {
65
- c .getName ( ) = "Argument" and
66
81
exists ( string arg , ParameterPosition ppos |
67
- arg = c .getAnArgument ( ) and
82
+ arg = c .getAnArgument ( "Argument" ) and
68
83
result = FlowSummary:: SummaryComponent:: argument ( ppos )
69
84
|
70
85
arg = "any" and
@@ -73,20 +88,17 @@ SummaryComponent interpretComponentSpecific(AccessPathToken c) {
73
88
ppos .isPositionalLowerBound ( AccessPath:: parseLowerBound ( arg ) )
74
89
)
75
90
or
76
- c .getName ( ) = "Element" and
77
- exists ( string arg | arg = c .getAnArgument ( ) |
78
- arg = "?" and
79
- result = FlowSummary:: SummaryComponent:: elementUnknown ( )
80
- or
81
- arg = "any" and
82
- result = FlowSummary:: SummaryComponent:: elementAny ( )
83
- or
84
- exists ( ConstantValue cv | result = FlowSummary:: SummaryComponent:: elementKnown ( cv ) |
85
- cv .isInt ( AccessPath:: parseInt ( arg ) )
86
- or
87
- not exists ( AccessPath:: parseInt ( arg ) ) and
88
- cv .serialize ( ) = c .getAnArgument ( )
89
- )
91
+ result = interpretElementArg ( c .getAnArgument ( "Element" ) )
92
+ or
93
+ exists ( ContentSet cs |
94
+ FlowSummary:: SummaryComponent:: content ( cs ) = interpretElementArg ( c .getAnArgument ( "WithElement" ) ) and
95
+ result = FlowSummary:: SummaryComponent:: withContent ( cs )
96
+ )
97
+ or
98
+ exists ( ContentSet cs |
99
+ FlowSummary:: SummaryComponent:: content ( cs ) =
100
+ interpretElementArg ( c .getAnArgument ( "WithoutElement" ) ) and
101
+ result = FlowSummary:: SummaryComponent:: withoutContent ( cs )
90
102
)
91
103
}
92
104
0 commit comments