Skip to content

Commit

Permalink
Removed Equatable from enums
Browse files Browse the repository at this point in the history
  • Loading branch information
angelolloqui committed Mar 29, 2020
1 parent be4a00f commit 5c30c68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Assets/Tests/KotlinTokenizer/enums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ enum AnimationLength {
}
}

enum AnimationLengthAdvanced {
enum AnimationLengthAdvanced: Equatable {
case short
case long
case custom(Double)
Expand Down
10 changes: 10 additions & 0 deletions Sources/SwiftKotlinFramework/utils/AST+Operations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,16 @@ extension GuardStatement {
}
}

extension TypeInheritanceClause {
var nonEquatable: TypeInheritanceClause? {
let typeInheritanceList = self.typeInheritanceList.nonEquatable
if typeInheritanceList.isEmpty {
return nil
}
return TypeInheritanceClause(classRequirement: classRequirement, typeInheritanceList: typeInheritanceList)
}
}

extension Collection where Iterator.Element == TypeIdentifier {
var nonEquatable: [TypeIdentifier] {
return filter { $0.names.contains { $0.name.textDescription != "Equatable" } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ extension KotlinTokenizer {
let lineBreak = declaration.newToken(.linebreak, "\n")
let attrsTokens = tokenize(declaration.attributes, node: declaration)
let modifierTokens = declaration.accessLevelModifier.map { tokenize($0, node: declaration) } ?? []
let inheritanceTokens = declaration.typeInheritanceClause.map { tokenize($0, node: declaration) } ?? []
let inheritanceTokens = declaration.typeInheritanceClause?.nonEquatable.map { tokenize($0, node: declaration) } ?? []
let headTokens = [
attrsTokens,
modifierTokens,
Expand Down

0 comments on commit 5c30c68

Please sign in to comment.