cousing -> sibling

This commit is contained in:
Erik Krogh Kristensen
2020-04-29 14:30:03 +02:00
parent f55005a0ec
commit 2ef13ef6e8

View File

@@ -163,23 +163,23 @@ class PlusConversion extends NullOrUndefinedConversion {
PlusConversion() { parent instanceof AddExpr or parent instanceof AssignAddExpr } PlusConversion() { parent instanceof AddExpr or parent instanceof AssignAddExpr }
override string getConversionTarget() { override string getConversionTarget() {
result = getDefiniteCousinType() result = getDefiniteSiblingType()
or or
not exists(getDefiniteCousinType()) and not exists(getDefiniteSiblingType()) and
result = "number or string" result = "number or string"
} }
/** /**
* Gets the cousin of this implicit conversion. * Gets the sibling of this implicit conversion.
* E.g. if this is `a` in the expression `a + b`, then the cousin is `b`. * E.g. if this is `a` in the expression `a + b`, then the sibling is `b`.
*/ */
private Expr getCousin() { result = parent.getAChild() and not result = this.getEnclosingExpr() } private Expr getSibling() { result = parent.getAChild() and not result = this.getEnclosingExpr() }
/** /**
* Gets the unique type of the cousin expression, if that type is `string` or `number`. * Gets the unique type of the sibling expression, if that type is `string` or `number`.
*/ */
private string getDefiniteCousinType() { private string getDefiniteSiblingType() {
result = unique(InferredType t | t = getCousin().flow().analyze().getAType()).getTypeofTag() and result = unique(InferredType t | t = getSibling().flow().analyze().getAType()).getTypeofTag() and
result = ["string", "number"] result = ["string", "number"]
} }
} }