Skip to content

Commit

Permalink
Fix infinite loop when parsing unknown parameter attribute (typealias…
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Muecke committed Jul 15, 2022
1 parent 5645d27 commit c35f9a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/MockingbirdGenerator/Parser/Models/Function.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct Function: CustomStringConvertible, CustomDebugStringConvertible, Serializ
mutableComponent = mutableComponent.dropFirst("@autoclosure".count)
} else if mutableComponent.hasPrefix("@") { // Unknown parameter attribute.
logWarning("Ignoring unknown parameter attribute \(String(mutableComponent).singleQuoted) in function type declaration \(String(serialized).singleQuoted)")
let index = mutableComponent.firstIndex(where: { !$0.isLetter && !$0.isNumber })
let index = mutableComponent.dropFirst().firstIndex(where: { !$0.isLetter && !$0.isNumber })
?? mutableComponent.endIndex
mutableComponent = mutableComponent[index...]
} else if mutableComponent == "inout" {
Expand Down

0 comments on commit c35f9a3

Please sign in to comment.