Skip to content

Commit 1114708

Browse files
committed
ignore static property
1 parent 6e83a02 commit 1114708

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Sources/CodableWrapperMacros/VariableDeclSyntaxExtension.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ extension VariableDeclSyntax {
66
/// This syntactic check cannot account for semantic adjustments due to,
77
/// e.g., accessor macros or property wrappers.
88
var isStoredProperty: Bool {
9+
if modifiers.compactMap({ $0.as(DeclModifierSyntax.self) }).contains(where: { $0.name.text == "static" }) {
10+
return false
11+
}
912
if bindings.count < 1 {
1013
return false
1114
}

Tests/CodableWrapperTests/ExampleTest.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ struct ExampleModel: Codable {
3939
@CodingKey("1") var testBool: Bool? = nil
4040

4141
var testFloats: [Float]?
42+
43+
static var empty: ExampleModel = .init()
4244
}
4345

4446
@Codable

0 commit comments

Comments
 (0)