Skip to content

Commit 2b3b3ba

Browse files
committed
Delete unused code and simplify catchall defaults
1 parent fd3019f commit 2b3b3ba

File tree

3 files changed

+4
-66
lines changed

3 files changed

+4
-66
lines changed

Sources/SafeDICore/Models/Dependency.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ public struct Dependency: Codable, Hashable {
4646

4747
// MARK: Internal
4848

49-
/// The label by which this property is referenced inside the `init` method.
50-
var propertyLabelInInit: String {
51-
property.label
52-
}
53-
5449
static let instantiatorType = "Instantiator"
5550
static let forwardingInstantiatorType = "ForwardingInstantiator"
5651
}

Sources/SafeDICore/Models/Property.swift

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,7 @@ public struct Property: Codable, Hashable, Comparable, Sendable {
7171
} else {
7272
return .constant
7373
}
74-
case .any,
75-
.array,
76-
.attributed,
77-
.closure,
78-
.composition,
79-
.dictionary,
80-
.implicitlyUnwrappedOptional,
81-
.metatype,
82-
.nested,
83-
.optional,
84-
.some,
85-
.tuple,
86-
.unknown:
74+
case .any, .array, .attributed, .closure, .composition, .dictionary, .implicitlyUnwrappedOptional, .metatype, .nested, .optional, .some, .tuple, .unknown:
8775
return .constant
8876
}
8977
}
@@ -93,18 +81,7 @@ public struct Property: Codable, Hashable, Comparable, Sendable {
9381
case let .simple(_, generics),
9482
let .nested(_, _, generics):
9583
return generics
96-
case .any,
97-
.array,
98-
.attributed,
99-
.closure,
100-
.composition,
101-
.dictionary,
102-
.implicitlyUnwrappedOptional,
103-
.metatype,
104-
.optional,
105-
.some,
106-
.tuple,
107-
.unknown:
84+
case .any, .array, .attributed, .closure, .composition, .dictionary, .implicitlyUnwrappedOptional, .metatype, .optional, .some, .tuple, .unknown:
10885
return []
10986
}
11087
}

Sources/SafeDICore/Models/TypeDescription.swift

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,6 @@ public enum TypeDescription: Codable, Hashable, Comparable, Sendable {
5151
/// A type that can't be represented by the above cases.
5252
case unknown(text: String)
5353

54-
/// Creates a type description of case `.nested` with the given name as the name and the receiver as the parent type.
55-
/// If no parent is provided, creates a type description of case `.simple`.
56-
///
57-
/// - Parameters:
58-
/// - name: The simple name of the returned type.
59-
/// - parent: The parent type for the returned type.
60-
/// - Note: This method only makes sense when the `parent` is of case `simple`, `nested`, `optional`, and `implicitlyUnwrappedOptional`.
61-
init(name: String, parent: TypeDescription?) {
62-
if let parent = parent {
63-
self = .nested(name: name, parentType: parent)
64-
} else {
65-
self = .simple(name: name)
66-
}
67-
}
68-
6954
/// A shortcut for creating a `simple` case without any generic types.
7055
public static func simple(name: String) -> TypeDescription {
7156
.simple(name: name, generics: [])
@@ -333,15 +318,7 @@ public enum TypeDescription: Codable, Hashable, Comparable, Sendable {
333318
let .optional(typeDescription),
334319
let .some(typeDescription):
335320
return typeDescription.asInstantiatedType
336-
case .array,
337-
.attributed,
338-
.closure,
339-
.composition,
340-
.dictionary,
341-
.metatype,
342-
.nested,
343-
.tuple,
344-
.unknown:
321+
case .array, .attributed, .closure, .composition, .dictionary, .metatype, .nested, .tuple, .unknown:
345322
return self
346323
}
347324
}
@@ -536,18 +513,7 @@ extension ExprSyntax {
536513
name: name,
537514
parentType: parentType, generics: genericTypeVisitor.genericArguments
538515
)
539-
case .any,
540-
.array,
541-
.attributed,
542-
.closure,
543-
.composition,
544-
.dictionary,
545-
.implicitlyUnwrappedOptional,
546-
.metatype,
547-
.optional,
548-
.some,
549-
.tuple,
550-
.unknown:
516+
case .any, .array, .attributed, .closure, .composition, .dictionary, .implicitlyUnwrappedOptional, .metatype, .optional, .some, .tuple, .unknown:
551517
return .unknown(text: description)
552518
}
553519
} else if let tupleExpr = TupleExprSyntax(self) {

0 commit comments

Comments
 (0)