@@ -56,15 +56,30 @@ predicate summaryElement(
5656 )
5757}
5858
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+
5975/**
6076 * Gets the summary component for specification component `c`, if any.
6177 *
6278 * This covers all the Ruby-specific components of a flow summary.
6379 */
6480SummaryComponent interpretComponentSpecific ( AccessPathToken c ) {
65- c .getName ( ) = "Argument" and
6681 exists ( string arg , ParameterPosition ppos |
67- arg = c .getAnArgument ( ) and
82+ arg = c .getAnArgument ( "Argument" ) and
6883 result = FlowSummary:: SummaryComponent:: argument ( ppos )
6984 |
7085 arg = "any" and
@@ -73,20 +88,17 @@ SummaryComponent interpretComponentSpecific(AccessPathToken c) {
7388 ppos .isPositionalLowerBound ( AccessPath:: parseLowerBound ( arg ) )
7489 )
7590 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 )
90102 )
91103}
92104
0 commit comments