Skip to content

Commit

Permalink
added dynamic to Variable
Browse files Browse the repository at this point in the history
  • Loading branch information
art-divin committed Dec 23, 2023
1 parent 864aa31 commit 4533c9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 8 additions & 2 deletions SourceryRuntime/Sources/AST/Variable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document

/// Whether variable is final or not
public var isFinal: Bool {
return modifiers.contains { $0.name == "final" }
return modifiers.contains { $0.name == Attribute.Identifier.final.rawValue }
}

/// Whether variable is lazy or not
public var isLazy: Bool {
return modifiers.contains { $0.name == "lazy" }
return modifiers.contains { $0.name == Attribute.Identifier.lazy.rawValue }
}

/// Whether variable is dynamic or not
public var isDynamic: Bool {
modifiers.contains { $0.name == Attribute.Identifier.dynamic.rawValue }
}

/// Reference to type name where the variable is defined,
Expand Down Expand Up @@ -145,6 +150,7 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document
string += "modifiers = \(String(describing: self.modifiers)), "
string += "isFinal = \(String(describing: self.isFinal)), "
string += "isLazy = \(String(describing: self.isLazy)), "
string += "isDynamic = \(String(describing: self.isDynamic)), "
string += "definedInTypeName = \(String(describing: self.definedInTypeName)), "
string += "actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName))"
return string
Expand Down
12 changes: 10 additions & 2 deletions SourceryRuntime/Sources/AST/Variable_Linux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document
return isArray
case "isDictionary":
return isDictionary
case "isDynamic":
return isDynamic
default:
fatalError("unable to lookup: \(member) in \(self)")
}
Expand Down Expand Up @@ -102,12 +104,17 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document

/// Whether variable is final or not
public var isFinal: Bool {
return modifiers.contains { $0.name == "final" }
return modifiers.contains { $0.name == Attribute.Identifier.final.rawValue }
}

/// Whether variable is lazy or not
public var isLazy: Bool {
return modifiers.contains { $0.name == "lazy" }
return modifiers.contains { $0.name == Attribute.Identifier.lazy.rawValue }
}

/// Whether variable is dynamic or not
public var isDynamic: Bool {
modifiers.contains { $0.name == Attribute.Identifier.dynamic.rawValue }
}

/// Reference to type name where the variable is defined,
Expand Down Expand Up @@ -177,6 +184,7 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document
string += "modifiers = \(String(describing: self.modifiers)), "
string += "isFinal = \(String(describing: self.isFinal)), "
string += "isLazy = \(String(describing: self.isLazy)), "
string += "isDynamic = \(String(describing: self.isDynamic)), "
string += "definedInTypeName = \(String(describing: self.definedInTypeName)), "
string += "actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName))"
return string
Expand Down

0 comments on commit 4533c9c

Please sign in to comment.