jextract: support Swift custom operators#829
Conversation
| return index == 0 ? name : name.firstCharacterUppercased | ||
| } | ||
| .joined() | ||
| } |
There was a problem hiding this comment.
Would be great to have a test for this, because e.g. we could have an operator ++++ which we'd like to then turn into plusPlusPlusPlus perhaps, so this is a "consume one operator, get the name, continue" operation.
Picking the known ones is good! but notice that knownOperatorNames[String(character)] wouldn't work for "==": "isEqual", or other known ones that have more characters.
There was a problem hiding this comment.
Oh, I didn’t know custom operators could have more than three characters, like ===========.
Thanks for noticing!
| } | ||
| private var deferredConstrainedExtensions: [DeferredConstrainedExtension] = [] | ||
|
|
||
| private static func isOperatorFunction(_ node: FunctionDeclSyntax) -> Bool { |
There was a problem hiding this comment.
This may be worth changing into operatorKind: SwiftOperatorKind?`
and make a new SwiftOperatorKind that is enum SwiftOperatorKind { case prefixOperator; case binaryOperator; case postfixOperator }
#817