Skip to content

Commit

Permalink
Some code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Sep 12, 2024
1 parent f2fce35 commit 9e877dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,6 @@ inline infix fun <reified T : HasOverloadedOperation> KClass<T>.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
Expand All @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ abstract class EdgeList<NodeType : Node, EdgeType : Edge<NodeType>>(
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) {
Expand Down

0 comments on commit 9e877dd

Please sign in to comment.