diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/LanguageTraits.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/LanguageTraits.kt index f19d468157..beb36b3661 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/LanguageTraits.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/LanguageTraits.kt @@ -264,13 +264,6 @@ inline infix fun KClass.of( return Pair(T::class, operatorCode) } -/** Checks whether the [Name] for a function is a known operator name. */ -context(LanguageProvider) -val Name.isKnownOperatorName: Boolean - get() { - return this.localName.isKnownOperatorName - } - /** Checks whether the name for a function (as [CharSequence]) is a known operator name. */ context(LanguageProvider) val CharSequence.isKnownOperatorName: Boolean @@ -280,5 +273,13 @@ val CharSequence.isKnownOperatorName: Boolean return false } - return language.overloadedOperatorNames.containsValue(this) + // If this is a parsed name, we only are interested in the local name + val name = + if (this is Name) { + this.localName + } else { + this + } + + return language.overloadedOperatorNames.containsValue(name) } diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/edges/collections/EdgeList.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/edges/collections/EdgeList.kt index ce3dcb69e4..cfbf9a8c03 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/edges/collections/EdgeList.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/edges/collections/EdgeList.kt @@ -82,6 +82,7 @@ abstract class EdgeList>( return ok } + /** Replaces the first occurrence of an edge with [old] with a new edge to [new]. */ fun replace(old: NodeType, new: NodeType): Boolean { val idx = this.indexOfFirst { it.end == old } if (idx != -1) {