We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13f113e commit 057218fCopy full SHA for 057218f
Sources/SwiftParser/Declarations.swift
@@ -281,9 +281,11 @@ extension Parser {
281
)
282
}
283
284
- let isProbablyFuncDecl = self.at(.identifier, .wildcard) || self.at(anyIn: Operator.self) != nil
+ let isPossibleFuncIdentifier = self.at(.identifier, .wildcard)
285
+ let isPossibleFuncParen = self.peek(isAt: .identifier, .leftParen) || self.peek(isAt: .identifier, .leftAngle)
286
- if isProbablyFuncDecl {
287
+ // Treat operators specially because they're likely to be functions.
288
+ if (isPossibleFuncIdentifier && isPossibleFuncParen) || self.at(anyIn: Operator.self) != nil {
289
return RawDeclSyntax(self.parseFuncDeclaration(attrs, .missing(.keyword(.func))))
290
291
0 commit comments