mirror of
https://github.com/github/codeql.git
synced 2026-01-30 06:42:57 +01:00
Use type to hint that constraining to embedded fields is a good first step
This improves the join order for `implicitFieldSelection`
This commit is contained in:
committed by
Owen Mansel-Chan
parent
e1b4867a19
commit
22a3fccf79
@@ -48,11 +48,15 @@ private predicate isCond(Expr e) {
|
||||
e = any(ParenExpr par | isCond(par)).getExpr()
|
||||
}
|
||||
|
||||
private class PromotedField extends Field {
|
||||
PromotedField() { this = any(StructType t).getFieldOfEmbedded(_, _, _, _) }
|
||||
}
|
||||
|
||||
private predicate implicitFieldSelection(SelectorExpr e, int i, Field implicitField) {
|
||||
exists(StructType baseType, Field child |
|
||||
exists(StructType baseType, PromotedField child |
|
||||
baseType = e.getBase().getType().getBaseType*().getUnderlyingType() and
|
||||
(
|
||||
e.getSelector() = child.getAReference()
|
||||
e.refersTo(child)
|
||||
or
|
||||
implicitFieldSelection(e, i + 1, child)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user