mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Ruby: Remove two Cartesian products
This commit is contained in:
committed by
Joe Farebrother
parent
5f08371f19
commit
605fe54a06
@@ -725,6 +725,7 @@ private module Cached {
|
||||
newtype TOptionalContentSet =
|
||||
TSingletonContent(Content c) or
|
||||
TAnyElementContent() or
|
||||
TAnyContent() or
|
||||
TKnownOrUnknownElementContent(Content::KnownElementContent c) or
|
||||
TElementLowerBoundContent(int lower, boolean includeUnknown) {
|
||||
FlowSummaryImpl::ParsePositions::isParsedElementLowerBoundPosition(_, includeUnknown, lower)
|
||||
@@ -736,7 +737,7 @@ private module Cached {
|
||||
|
||||
cached
|
||||
class TContentSet =
|
||||
TSingletonContent or TAnyElementContent or TKnownOrUnknownElementContent or
|
||||
TSingletonContent or TAnyElementContent or TAnyContent or TKnownOrUnknownElementContent or
|
||||
TElementLowerBoundContent or TElementContentOfTypeContent;
|
||||
|
||||
private predicate trackKnownValue(ConstantValue cv) {
|
||||
|
||||
@@ -689,6 +689,9 @@ class ContentSet extends TContentSet {
|
||||
/** Holds if this content set represents all `ElementContent`s. */
|
||||
predicate isAnyElement() { this = TAnyElementContent() }
|
||||
|
||||
/** Holds if this content set represents all contents. */
|
||||
predicate isAny() { this = TAnyContent() }
|
||||
|
||||
/**
|
||||
* Holds if this content set represents a specific known element index, or an
|
||||
* unknown element index.
|
||||
@@ -737,6 +740,9 @@ class ContentSet extends TContentSet {
|
||||
this.isAnyElement() and
|
||||
result = "any element"
|
||||
or
|
||||
this.isAny() and
|
||||
result = "any"
|
||||
or
|
||||
exists(Content::KnownElementContent c |
|
||||
this.isKnownOrUnknownElement(c) and
|
||||
result = c + " or unknown"
|
||||
@@ -790,13 +796,8 @@ class ContentSet extends TContentSet {
|
||||
result = TUnknownElementContent()
|
||||
}
|
||||
|
||||
/** Gets a content that may be read from when reading from this set. */
|
||||
Content getAReadContent() {
|
||||
this.isSingleton(result)
|
||||
or
|
||||
this.isAnyElement() and
|
||||
result instanceof Content::ElementContent
|
||||
or
|
||||
pragma[nomagic]
|
||||
private Content getAnElementReadContent() {
|
||||
exists(Content::KnownElementContent c | this.isKnownOrUnknownElement(c) |
|
||||
result = c or
|
||||
result = TSplatContent(c.getIndex().getInt(), _) or
|
||||
@@ -832,6 +833,19 @@ class ContentSet extends TContentSet {
|
||||
result = TUnknownElementContent()
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets a content that may be read from when reading from this set. */
|
||||
Content getAReadContent() {
|
||||
this.isSingleton(result)
|
||||
or
|
||||
this.isAnyElement() and
|
||||
result instanceof Content::ElementContent
|
||||
or
|
||||
this.isAny() and
|
||||
exists(result)
|
||||
or
|
||||
result = this.getAnElementReadContent()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ private module Config implements DataFlow::ConfigSig {
|
||||
}
|
||||
|
||||
predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet cs) {
|
||||
exists(cs) and
|
||||
cs.isAny() and
|
||||
isSink(node)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ private module Config implements DataFlow::ConfigSig {
|
||||
}
|
||||
|
||||
predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet cs) {
|
||||
exists(cs) and
|
||||
cs.isAny() and
|
||||
isSink(node)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user