Rust: Workaround for method existing both as source and as dependency

This commit is contained in:
Simon Friis Vindum
2025-05-01 09:07:58 +02:00
parent 781be8df42
commit 3f4bf764d6

View File

@@ -31,8 +31,9 @@ module Impl {
* ```
*/
class MethodCallExpr extends Generated::MethodCallExpr {
override Function getStaticTarget() {
private Function getStaticTargetFrom(boolean fromSource) {
result = resolveMethodCallExpr(this) and
(if result.fromSource() then fromSource = true else fromSource = false) and
(
// prioritize inherent implementation methods first
isInherentImplFunction(result)
@@ -54,6 +55,13 @@ module Impl {
)
}
override Function getStaticTarget() {
result = this.getStaticTargetFrom(true)
or
not exists(this.getStaticTargetFrom(true)) and
result = this.getStaticTargetFrom(false)
}
private string toStringPart(int index) {
index = 0 and
result = this.getReceiver().toAbbreviatedString()