mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
Merge pull request #13262 from michaelnebel/flowsummary/refactorgetcomponentstack
C#: Re-factor getComponent.
This commit is contained in:
@@ -166,28 +166,21 @@ module Public {
|
|||||||
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate noComponentSpecific(SummaryComponent sc) {
|
|
||||||
not exists(getComponentSpecific(sc))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets a textual representation of this component used for flow summaries. */
|
/** Gets a textual representation of this component used for flow summaries. */
|
||||||
private string getComponent(SummaryComponent sc) {
|
private string getComponent(SummaryComponent sc) {
|
||||||
result = getComponentSpecific(sc)
|
result = getComponentSpecific(sc)
|
||||||
or
|
or
|
||||||
noComponentSpecific(sc) and
|
exists(ArgumentPosition pos |
|
||||||
(
|
sc = TParameterSummaryComponent(pos) and
|
||||||
exists(ArgumentPosition pos |
|
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
||||||
sc = TParameterSummaryComponent(pos) and
|
|
||||||
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
exists(ParameterPosition pos |
|
|
||||||
sc = TArgumentSummaryComponent(pos) and
|
|
||||||
result = "Argument[" + getParameterPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
|
||||||
)
|
)
|
||||||
|
or
|
||||||
|
exists(ParameterPosition pos |
|
||||||
|
sc = TArgumentSummaryComponent(pos) and
|
||||||
|
result = "Argument[" + getParameterPosition(pos) + "]"
|
||||||
|
)
|
||||||
|
or
|
||||||
|
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this stack used for flow summaries. */
|
/** Gets a textual representation of this stack used for flow summaries. */
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ string getComponentSpecific(SummaryComponent sc) {
|
|||||||
or
|
or
|
||||||
exists(ReturnKind rk |
|
exists(ReturnKind rk |
|
||||||
sc = TReturnSummaryComponent(rk) and
|
sc = TReturnSummaryComponent(rk) and
|
||||||
result = "ReturnValue[" + rk + "]" and
|
not rk = getReturnValueKind() and
|
||||||
not rk instanceof NormalReturnKind
|
result = "ReturnValue[" + rk + "]"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,28 +166,21 @@ module Public {
|
|||||||
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate noComponentSpecific(SummaryComponent sc) {
|
|
||||||
not exists(getComponentSpecific(sc))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets a textual representation of this component used for flow summaries. */
|
/** Gets a textual representation of this component used for flow summaries. */
|
||||||
private string getComponent(SummaryComponent sc) {
|
private string getComponent(SummaryComponent sc) {
|
||||||
result = getComponentSpecific(sc)
|
result = getComponentSpecific(sc)
|
||||||
or
|
or
|
||||||
noComponentSpecific(sc) and
|
exists(ArgumentPosition pos |
|
||||||
(
|
sc = TParameterSummaryComponent(pos) and
|
||||||
exists(ArgumentPosition pos |
|
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
||||||
sc = TParameterSummaryComponent(pos) and
|
|
||||||
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
exists(ParameterPosition pos |
|
|
||||||
sc = TArgumentSummaryComponent(pos) and
|
|
||||||
result = "Argument[" + getParameterPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
|
||||||
)
|
)
|
||||||
|
or
|
||||||
|
exists(ParameterPosition pos |
|
||||||
|
sc = TArgumentSummaryComponent(pos) and
|
||||||
|
result = "Argument[" + getParameterPosition(pos) + "]"
|
||||||
|
)
|
||||||
|
or
|
||||||
|
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this stack used for flow summaries. */
|
/** Gets a textual representation of this stack used for flow summaries. */
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ private string getContentSpecific(Content c) {
|
|||||||
string getComponentSpecific(SummaryComponent sc) {
|
string getComponentSpecific(SummaryComponent sc) {
|
||||||
exists(Content c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c))
|
exists(Content c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c))
|
||||||
or
|
or
|
||||||
exists(ReturnKind rk, int n | n = rk.getIndex() |
|
exists(ReturnKind rk |
|
||||||
sc = TReturnSummaryComponent(rk) and
|
sc = TReturnSummaryComponent(rk) and
|
||||||
result = "ReturnValue[" + n + "]" and
|
not rk = getReturnValueKind() and
|
||||||
n != 0
|
result = "ReturnValue[" + rk.getIndex() + "]"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,28 +166,21 @@ module Public {
|
|||||||
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate noComponentSpecific(SummaryComponent sc) {
|
|
||||||
not exists(getComponentSpecific(sc))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets a textual representation of this component used for flow summaries. */
|
/** Gets a textual representation of this component used for flow summaries. */
|
||||||
private string getComponent(SummaryComponent sc) {
|
private string getComponent(SummaryComponent sc) {
|
||||||
result = getComponentSpecific(sc)
|
result = getComponentSpecific(sc)
|
||||||
or
|
or
|
||||||
noComponentSpecific(sc) and
|
exists(ArgumentPosition pos |
|
||||||
(
|
sc = TParameterSummaryComponent(pos) and
|
||||||
exists(ArgumentPosition pos |
|
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
||||||
sc = TParameterSummaryComponent(pos) and
|
|
||||||
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
exists(ParameterPosition pos |
|
|
||||||
sc = TArgumentSummaryComponent(pos) and
|
|
||||||
result = "Argument[" + getParameterPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
|
||||||
)
|
)
|
||||||
|
or
|
||||||
|
exists(ParameterPosition pos |
|
||||||
|
sc = TArgumentSummaryComponent(pos) and
|
||||||
|
result = "Argument[" + getParameterPosition(pos) + "]"
|
||||||
|
)
|
||||||
|
or
|
||||||
|
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this stack used for flow summaries. */
|
/** Gets a textual representation of this stack used for flow summaries. */
|
||||||
|
|||||||
@@ -166,28 +166,21 @@ module Public {
|
|||||||
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate noComponentSpecific(SummaryComponent sc) {
|
|
||||||
not exists(getComponentSpecific(sc))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets a textual representation of this component used for flow summaries. */
|
/** Gets a textual representation of this component used for flow summaries. */
|
||||||
private string getComponent(SummaryComponent sc) {
|
private string getComponent(SummaryComponent sc) {
|
||||||
result = getComponentSpecific(sc)
|
result = getComponentSpecific(sc)
|
||||||
or
|
or
|
||||||
noComponentSpecific(sc) and
|
exists(ArgumentPosition pos |
|
||||||
(
|
sc = TParameterSummaryComponent(pos) and
|
||||||
exists(ArgumentPosition pos |
|
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
||||||
sc = TParameterSummaryComponent(pos) and
|
|
||||||
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
exists(ParameterPosition pos |
|
|
||||||
sc = TArgumentSummaryComponent(pos) and
|
|
||||||
result = "Argument[" + getParameterPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
|
||||||
)
|
)
|
||||||
|
or
|
||||||
|
exists(ParameterPosition pos |
|
||||||
|
sc = TArgumentSummaryComponent(pos) and
|
||||||
|
result = "Argument[" + getParameterPosition(pos) + "]"
|
||||||
|
)
|
||||||
|
or
|
||||||
|
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this stack used for flow summaries. */
|
/** Gets a textual representation of this stack used for flow summaries. */
|
||||||
|
|||||||
@@ -166,28 +166,21 @@ module Public {
|
|||||||
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate noComponentSpecific(SummaryComponent sc) {
|
|
||||||
not exists(getComponentSpecific(sc))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets a textual representation of this component used for flow summaries. */
|
/** Gets a textual representation of this component used for flow summaries. */
|
||||||
private string getComponent(SummaryComponent sc) {
|
private string getComponent(SummaryComponent sc) {
|
||||||
result = getComponentSpecific(sc)
|
result = getComponentSpecific(sc)
|
||||||
or
|
or
|
||||||
noComponentSpecific(sc) and
|
exists(ArgumentPosition pos |
|
||||||
(
|
sc = TParameterSummaryComponent(pos) and
|
||||||
exists(ArgumentPosition pos |
|
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
||||||
sc = TParameterSummaryComponent(pos) and
|
|
||||||
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
exists(ParameterPosition pos |
|
|
||||||
sc = TArgumentSummaryComponent(pos) and
|
|
||||||
result = "Argument[" + getParameterPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
|
||||||
)
|
)
|
||||||
|
or
|
||||||
|
exists(ParameterPosition pos |
|
||||||
|
sc = TArgumentSummaryComponent(pos) and
|
||||||
|
result = "Argument[" + getParameterPosition(pos) + "]"
|
||||||
|
)
|
||||||
|
or
|
||||||
|
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this stack used for flow summaries. */
|
/** Gets a textual representation of this stack used for flow summaries. */
|
||||||
|
|||||||
@@ -166,28 +166,21 @@ module Public {
|
|||||||
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate noComponentSpecific(SummaryComponent sc) {
|
|
||||||
not exists(getComponentSpecific(sc))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets a textual representation of this component used for flow summaries. */
|
/** Gets a textual representation of this component used for flow summaries. */
|
||||||
private string getComponent(SummaryComponent sc) {
|
private string getComponent(SummaryComponent sc) {
|
||||||
result = getComponentSpecific(sc)
|
result = getComponentSpecific(sc)
|
||||||
or
|
or
|
||||||
noComponentSpecific(sc) and
|
exists(ArgumentPosition pos |
|
||||||
(
|
sc = TParameterSummaryComponent(pos) and
|
||||||
exists(ArgumentPosition pos |
|
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
||||||
sc = TParameterSummaryComponent(pos) and
|
|
||||||
result = "Parameter[" + getArgumentPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
exists(ParameterPosition pos |
|
|
||||||
sc = TArgumentSummaryComponent(pos) and
|
|
||||||
result = "Argument[" + getParameterPosition(pos) + "]"
|
|
||||||
)
|
|
||||||
or
|
|
||||||
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
|
||||||
)
|
)
|
||||||
|
or
|
||||||
|
exists(ParameterPosition pos |
|
||||||
|
sc = TArgumentSummaryComponent(pos) and
|
||||||
|
result = "Argument[" + getParameterPosition(pos) + "]"
|
||||||
|
)
|
||||||
|
or
|
||||||
|
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this stack used for flow summaries. */
|
/** Gets a textual representation of this stack used for flow summaries. */
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ string getComponentSpecific(SummaryComponent sc) {
|
|||||||
or
|
or
|
||||||
exists(ReturnKind rk |
|
exists(ReturnKind rk |
|
||||||
sc = TReturnSummaryComponent(rk) and
|
sc = TReturnSummaryComponent(rk) and
|
||||||
result = "ReturnValue[" + rk + "]" and
|
not rk = getReturnValueKind() and
|
||||||
not rk instanceof NormalReturnKind
|
result = "ReturnValue" + "[" + rk + "]"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user