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 6, 2024
1 parent af76b7a commit 40b46d3
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 @@ -245,13 +245,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 @@ -261,5 +254,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 40b46d3

Please sign in to comment.