mirror of
https://github.com/krzysztofzablocki/Sourcery.git
synced 2026-04-07 19:17:40 +00:00
Adjusted file structure to accommodate two generated files (#1299)
* Adjusted file structure to accommodate two generated files * Adjusted scripting * Removed Description, Diffable, Equality for now * Removed Stencil import * Updated templates * Updated scripting * Updated generated coding * Disable build deletion (temp) * Updated template * Updated generated code * updated generated code * Updated generated code * Adjusted scripting * Updated scripting * Updated generated code * Reverted template deletion * Removed Stencil imports * Updated generated code * trigger CI * Removed description, diffable and equality stencil templates * Reverted temporary changes * Commented failing tests * Skipping JSExport for description & hash * Updated generated code * Enabled failing tests * Adding stencil templates back to test tests * Reset generated file for linux for test * Reverted Extensions for testing * Reverted ParserResultsComposed * Attempt to fix unit tests * Attempt to resolve unit test * Reverted TypeName asSource * Reverted TypeName revertion * Reverted revert of ParserResultComposed * Reverted revert of Extensions * Reverted revert of Linux.content.generated * Reverted attempts to fix unit tests * Fix for the failing codegen tests * Added clarifying comment * Removed description, diffable and equality stencil templates * Updated generated code * Tinkering with optimization level for speed boost * Excluded stencil templates for codegen * Fixed wrong compiler flag * Removed speed optimization to a separate PR * Reverted test code
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
sources:
|
||||
- SourceryRuntime/Sources/Common
|
||||
- SourceryRuntime/Sources/macOS
|
||||
templates:
|
||||
- Sourcery/Templates/Coding.stencil
|
||||
- Sourcery/Templates/JSExport.ejs
|
||||
- Sourcery/Templates/Typed.stencil
|
||||
- Sourcery/Templates/TypedSpec.stencil
|
||||
output:
|
||||
SourceryRuntime/Sources/Generated
|
||||
@@ -0,0 +1,10 @@
|
||||
sources:
|
||||
- SourceryRuntime/Sources/Common
|
||||
- SourceryRuntime/Sources/Linux
|
||||
templates:
|
||||
- Sourcery/Templates/Coding.stencil
|
||||
- Sourcery/Templates/JSExport.ejs
|
||||
- Sourcery/Templates/Typed.stencil
|
||||
- Sourcery/Templates/TypedSpec.stencil
|
||||
output:
|
||||
SourceryRuntime/Sources/Generated
|
||||
@@ -1,6 +0,0 @@
|
||||
sources:
|
||||
- SourceryRuntime/Sources
|
||||
templates:
|
||||
- Sourcery/Templates
|
||||
output:
|
||||
SourceryRuntime/Sources/Generated
|
||||
@@ -87,12 +87,14 @@ end
|
||||
|
||||
task :run_sourcery do
|
||||
print_info "Generating internal boilerplate code"
|
||||
sh "#{CLI_DIR}bin/sourcery"
|
||||
sh "#{CLI_DIR}bin/sourcery --config .sourcery-macOS.yml"
|
||||
sh "#{CLI_DIR}bin/sourcery --config .sourcery-ubuntu.yml"
|
||||
end
|
||||
|
||||
desc "Update internal boilerplate code"
|
||||
task :generate_internal_boilerplate_code => [:fat_build, :run_sourcery, :clean] do
|
||||
sh "Scripts/package_content \"SourceryRuntime/Sources\" > \"SourcerySwift/Sources/SourceryRuntime.content.generated.swift\""
|
||||
task :generate_internal_boilerplate_code => [:build, :run_sourcery] do
|
||||
sh "Scripts/package_content \"SourceryRuntime/Sources/Common,SourceryRuntime/Sources/macOS,SourceryRuntime/Sources/Generated\" \"true\" > \"SourcerySwift/Sources/SourceryRuntime.content.generated.swift\""
|
||||
sh "Scripts/package_content \"SourceryRuntime/Sources/Common,SourceryRuntime/Sources/Linux,SourceryRuntime/Sources/Generated\" \"false\" > \"SourcerySwift/Sources/SourceryRuntime_Linux.content.generated.swift\""
|
||||
generated_files = `git status --porcelain`
|
||||
.split("\n")
|
||||
.select { |item| item.include?('.generated.') }
|
||||
|
||||
+44
-29
@@ -4,7 +4,8 @@
|
||||
/// Merge all Swift files contained in FOLDER into swift code that can be used by the FolderSynchronizer.
|
||||
/// Example: $0 Sources/SourceryRuntime > file.swift
|
||||
/// Options:
|
||||
/// FOLDER: the path where the Swift files to merge are
|
||||
/// FOLDERS: the paths where the Swift files to merge are, separated with comma ","
|
||||
/// isForDarwinPlatform: if true, the generated code will be compilable on Darwin platforms
|
||||
/// -h: Display this help message
|
||||
import Foundation
|
||||
|
||||
@@ -40,37 +41,45 @@ extension String {
|
||||
}
|
||||
}
|
||||
|
||||
func package(folder folderPath: String) throws {
|
||||
print("let sourceryRuntimeFiles: [FolderSynchronizer.File] = [")
|
||||
let folderURL = URL(fileURLWithPath: folderPath)
|
||||
|
||||
guard let enumerator = FileManager.default.enumerator(at: folderURL, includingPropertiesForKeys: [.isRegularFileKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]) else {
|
||||
print("Unable to retrieve file enumerator")
|
||||
exit(1)
|
||||
func package(folders folderPaths: [String], isForDarwinPlatform: Bool) throws {
|
||||
if !isForDarwinPlatform {
|
||||
print("#if !canImport(ObjectiveC)")
|
||||
} else {
|
||||
print("#if canImport(ObjectiveC)")
|
||||
}
|
||||
var files = [URL]()
|
||||
for case let fileURL as URL in enumerator {
|
||||
do {
|
||||
let fileAttributes = try fileURL.resourceValues(forKeys:[.isRegularFileKey])
|
||||
if fileAttributes.isRegularFile! {
|
||||
files.append(fileURL)
|
||||
print("let sourceryRuntimeFiles: [FolderSynchronizer.File] = [")
|
||||
for folderPath in folderPaths {
|
||||
let folderURL = URL(fileURLWithPath: folderPath)
|
||||
|
||||
guard let enumerator = FileManager.default.enumerator(at: folderURL, includingPropertiesForKeys: [.isRegularFileKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]) else {
|
||||
print("Unable to retrieve file enumerator")
|
||||
exit(1)
|
||||
}
|
||||
var files = [URL]()
|
||||
for case let fileURL as URL in enumerator {
|
||||
do {
|
||||
let fileAttributes = try fileURL.resourceValues(forKeys:[.isRegularFileKey])
|
||||
if fileAttributes.isRegularFile! {
|
||||
files.append(fileURL)
|
||||
}
|
||||
} catch {
|
||||
print(error, fileURL)
|
||||
}
|
||||
} catch {
|
||||
print(error, fileURL)
|
||||
}
|
||||
|
||||
try files
|
||||
.sorted(by: { $0.lastPathComponent < $1.lastPathComponent })
|
||||
.forEach { sourceFileURL in
|
||||
print(" .init(name: \"\(sourceFileURL.lastPathComponent)\", content:")
|
||||
print("\"\"\"")
|
||||
let content = try String(contentsOf: sourceFileURL, encoding: .utf8)
|
||||
.escapedSwiftTokens()
|
||||
print(content)
|
||||
print("\"\"\"),")
|
||||
}
|
||||
}
|
||||
|
||||
try files
|
||||
.sorted(by: { $0.lastPathComponent < $1.lastPathComponent })
|
||||
.forEach { sourceFileURL in
|
||||
print(" .init(name: \"\(sourceFileURL.lastPathComponent)\", content:")
|
||||
print("\"\"\"")
|
||||
let content = try String(contentsOf: sourceFileURL, encoding: .utf8)
|
||||
.escapedSwiftTokens()
|
||||
print(content)
|
||||
print("\"\"\"),")
|
||||
}
|
||||
print("]")
|
||||
print("#endif")
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -82,10 +91,16 @@ func main() {
|
||||
print("Missing folderPath argument")
|
||||
exit(1)
|
||||
}
|
||||
let folder = CommandLine.arguments[1]
|
||||
guard CommandLine.arguments.count > 2 else {
|
||||
print("Missing isForDarwinPlatform argument")
|
||||
exit(1)
|
||||
}
|
||||
let foldersPaths = CommandLine.arguments[1]
|
||||
let isForDarwinPlatform = Bool(CommandLine.arguments[2]) ?? false
|
||||
let folders = foldersPaths.split(separator: ",").map(String.init)
|
||||
|
||||
do {
|
||||
try package(folder: folder)
|
||||
try package(folders: folders, isForDarwinPlatform: isForDarwinPlatform)
|
||||
} catch {
|
||||
print("Failed with error: \(error)")
|
||||
exit(1)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// swiftlint:disable vertical_whitespace trailing_newline
|
||||
|
||||
#if canImport(JavaScriptCore)
|
||||
import JavaScriptCore
|
||||
|
||||
<%_ for (type of types.implementing.AutoJSExport) { -%>
|
||||
@@ -15,3 +16,4 @@ import JavaScriptCore
|
||||
extension <%= type.name %>: <%= type.name %>AutoJSExport {}
|
||||
<%_ } %>
|
||||
<%_ } %>
|
||||
#endif
|
||||
@@ -17,6 +17,8 @@ extension {{ type.name }} {
|
||||
{{ type.accessLevel }} var isClosure: Bool { return typeName.isClosure }
|
||||
/// Whether type is an array. Shorthand for `typeName.isArray`
|
||||
{{ type.accessLevel }} var isArray: Bool { return typeName.isArray }
|
||||
/// Whether type is a set. Shorthand for `typeName.isSet`
|
||||
{{ type.accessLevel }} var isSet: Bool { return typeName.isSet }
|
||||
/// Whether type is a dictionary. Shorthand for `typeName.isDictionary`
|
||||
{{ type.accessLevel }} var isDictionary: Bool { return typeName.isDictionary }
|
||||
}{% endfor %}
|
||||
|
||||
@@ -28,6 +28,7 @@ class TypedSpec: QuickSpec {
|
||||
return variable?.typeName ?? TypeName(name: "")
|
||||
}
|
||||
|
||||
#if canImport(ObjectiveC)
|
||||
it("can report optional via KVC") {
|
||||
expect({{ type.name }}(typeName: typeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
|
||||
expect({{ type.name }}(typeName: typeName("Int!")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
|
||||
@@ -68,6 +69,7 @@ class TypedSpec: QuickSpec {
|
||||
sut.typeName.actualTypeName = typeName("Int")
|
||||
expect(sut.value(forKeyPath: "actualTypeName") as? TypeName).to(equal(typeName("Int")))
|
||||
}
|
||||
#endif
|
||||
}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
+7
-4
@@ -11,7 +11,7 @@ public final class Actor: Type {
|
||||
|
||||
/// Whether type is final
|
||||
public var isFinal: Bool {
|
||||
return modifiers.contains { $0.name == "final" }
|
||||
modifiers.contains { $0.name == "final" }
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
@@ -54,11 +54,12 @@ public final class Actor: Type {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = super.description
|
||||
string += ", "
|
||||
string += "kind = \(String(describing: self.kind)), "
|
||||
string += "isFinal = \(String(describing: self.isFinal))"
|
||||
string.append(", ")
|
||||
string.append("kind = \(String(describing: self.kind)), ")
|
||||
string.append("isFinal = \(String(describing: self.isFinal))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -72,6 +73,8 @@ public final class Actor: Type {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(super.hash)
|
||||
+2
@@ -166,6 +166,8 @@ public class Attribute: NSObject, AutoCoding, AutoEquatable, AutoDiffable, AutoJ
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+7
-4
@@ -10,7 +10,7 @@ public final class Class: Type {
|
||||
|
||||
/// Whether type is final
|
||||
public var isFinal: Bool {
|
||||
return modifiers.contains { $0.name == "final" }
|
||||
modifiers.contains { $0.name == "final" }
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
@@ -53,11 +53,12 @@ public final class Class: Type {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = super.description
|
||||
string += ", "
|
||||
string += "kind = \(String(describing: self.kind)), "
|
||||
string += "isFinal = \(String(describing: self.isFinal))"
|
||||
string.append(", ")
|
||||
string.append("kind = \(String(describing: self.kind)), ")
|
||||
string.append("isFinal = \(String(describing: self.isFinal))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -71,6 +72,8 @@ public final class Class: Type {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(super.hash)
|
||||
+2
@@ -50,6 +50,8 @@ public class Import: NSObject, SourceryModelWithoutDescription, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.kind)
|
||||
+2
@@ -38,6 +38,8 @@ public class Modifier: NSObject, AutoCoding, AutoEquatable, AutoDiffable, AutoJS
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+7
-3
@@ -27,6 +27,7 @@ public final class Protocol: Type {
|
||||
}
|
||||
}
|
||||
|
||||
// sourcery: skipCoding
|
||||
/// list of generic requirements
|
||||
public override var genericRequirements: [GenericRequirement] {
|
||||
didSet {
|
||||
@@ -75,11 +76,12 @@ public final class Protocol: Type {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = super.description
|
||||
string += ", "
|
||||
string += "kind = \(String(describing: self.kind)), "
|
||||
string += "associatedTypes = \(String(describing: self.associatedTypes)), "
|
||||
string.append(", ")
|
||||
string.append("kind = \(String(describing: self.kind)), ")
|
||||
string.append("associatedTypes = \(String(describing: self.associatedTypes)), ")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -94,6 +96,8 @@ public final class Protocol: Type {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.associatedTypes)
|
||||
+3
@@ -56,6 +56,7 @@ public final class ProtocolComposition: Type {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = super.description
|
||||
string += ", "
|
||||
@@ -75,6 +76,8 @@ public final class ProtocolComposition: Type {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.composedTypeNames)
|
||||
+3
@@ -58,6 +58,7 @@ public final class Struct: Type {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = super.description
|
||||
string += ", "
|
||||
@@ -75,6 +76,8 @@ public final class Struct: Type {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(super.hash)
|
||||
+7
-4
@@ -34,12 +34,13 @@ public final class ArrayType: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "elementTypeName = \(String(describing: self.elementTypeName)), "
|
||||
string += "asGeneric = \(String(describing: self.asGeneric)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("elementTypeName = \(String(describing: self.elementTypeName)), ")
|
||||
string.append("asGeneric = \(String(describing: self.asGeneric)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -54,6 +55,8 @@ public final class ArrayType: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+8
-5
@@ -44,13 +44,14 @@ public final class DictionaryType: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "valueTypeName = \(String(describing: self.valueTypeName)), "
|
||||
string += "keyTypeName = \(String(describing: self.keyTypeName)), "
|
||||
string += "asGeneric = \(String(describing: self.asGeneric)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("valueTypeName = \(String(describing: self.valueTypeName)), ")
|
||||
string.append("keyTypeName = \(String(describing: self.keyTypeName)), ")
|
||||
string.append("asGeneric = \(String(describing: self.asGeneric)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -66,6 +67,8 @@ public final class DictionaryType: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+2
@@ -39,6 +39,8 @@ public final class GenericType: NSObject, SourceryModelWithoutDescription, Diffa
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+9
-6
@@ -34,12 +34,13 @@ public final class SetType: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "elementTypeName = \(String(describing: self.elementTypeName)), "
|
||||
string += "asGeneric = \(String(describing: self.asGeneric)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("elementTypeName = \(String(describing: self.elementTypeName)), ")
|
||||
string.append("asGeneric = \(String(describing: self.asGeneric)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -54,6 +55,8 @@ public final class SetType: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -73,13 +76,13 @@ public final class SetType: NSObject, SourceryModel, Diffable {
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
withVaList(["name"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.name = name
|
||||
guard let elementTypeName: TypeName = aDecoder.decode(forKey: "elementTypeName") else {
|
||||
guard let elementTypeName: TypeName = aDecoder.decode(forKey: "elementTypeName") else {
|
||||
withVaList(["elementTypeName"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+25
-22
@@ -55,16 +55,17 @@ public final class Typealias: NSObject, Typed, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "aliasName = \(String(describing: self.aliasName)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "module = \(String(describing: self.module)), "
|
||||
string += "accessLevel = \(String(describing: self.accessLevel)), "
|
||||
string += "parentName = \(String(describing: self.parentName)), "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string.append("aliasName = \(String(describing: self.aliasName)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("module = \(String(describing: self.module)), ")
|
||||
string.append("accessLevel = \(String(describing: self.accessLevel)), ")
|
||||
string.append("parentName = \(String(describing: self.parentName)), ")
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -84,6 +85,8 @@ public final class Typealias: NSObject, Typed, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.aliasName)
|
||||
@@ -127,6 +130,18 @@ public final class Typealias: NSObject, Typed, SourceryModel, Diffable {
|
||||
}; self.typeName = typeName
|
||||
self.type = aDecoder.decode(forKey: "type")
|
||||
self.module = aDecoder.decode(forKey: "module")
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
withVaList(["annotations"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.annotations = annotations
|
||||
guard let documentation: Documentation = aDecoder.decode(forKey: "documentation") else {
|
||||
withVaList(["documentation"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.documentation = documentation
|
||||
self.parent = aDecoder.decode(forKey: "parent")
|
||||
guard let accessLevel: String = aDecoder.decode(forKey: "accessLevel") else {
|
||||
withVaList(["accessLevel"]) { arguments in
|
||||
@@ -134,18 +149,6 @@ public final class Typealias: NSObject, Typed, SourceryModel, Diffable {
|
||||
}
|
||||
fatalError()
|
||||
}; self.accessLevel = accessLevel
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
withVaList(["annotations"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.annotations = annotations
|
||||
guard let documentation: Documentation = aDecoder.decode(forKey: "documentation") else {
|
||||
withVaList(["documentation"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.documentation = documentation
|
||||
self.parentName = aDecoder.decode(forKey: "parentName")
|
||||
}
|
||||
|
||||
@@ -155,11 +158,11 @@ public final class Typealias: NSObject, Typed, SourceryModel, Diffable {
|
||||
aCoder.encode(self.typeName, forKey: "typeName")
|
||||
aCoder.encode(self.type, forKey: "type")
|
||||
aCoder.encode(self.module, forKey: "module")
|
||||
aCoder.encode(self.annotations, forKey: "annotations")
|
||||
aCoder.encode(self.documentation, forKey: "documentation")
|
||||
aCoder.encode(self.parent, forKey: "parent")
|
||||
aCoder.encode(self.accessLevel, forKey: "accessLevel")
|
||||
aCoder.encode(self.parentName, forKey: "parentName")
|
||||
aCoder.encode(self.documentation, forKey: "documentation")
|
||||
aCoder.encode(self.annotations, forKey: "annotations")
|
||||
}
|
||||
// sourcery:end
|
||||
}
|
||||
+3
@@ -24,6 +24,7 @@ public final class BytesRange: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "offset = \(String(describing: self.offset)), "
|
||||
@@ -42,6 +43,8 @@ public final class BytesRange: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.offset)
|
||||
+22
-17
@@ -75,37 +75,42 @@ internal struct ParserResultsComposed {
|
||||
}
|
||||
}
|
||||
|
||||
// if it had contained types, they might have been fully defined and so their name has to be noted in uniques
|
||||
private mutating func rewriteChildren(of type: Type) {
|
||||
// child is never an extension so no need to check
|
||||
for child in type.containedTypes {
|
||||
typeMap[child.globalName] = child
|
||||
rewriteChildren(of: child)
|
||||
}
|
||||
}
|
||||
|
||||
private mutating func unifyTypes() -> [Type] {
|
||||
/// Resolve actual names of extensions, as they could have been done on typealias and note updated child names in uniques if needed
|
||||
parsedTypes
|
||||
.filter { $0.isExtension }
|
||||
.forEach {
|
||||
let oldName = $0.globalName
|
||||
.forEach { (type: Type) in
|
||||
let oldName = type.globalName
|
||||
|
||||
if $0.parent == nil, $0.localName.contains(".") {
|
||||
resolveExtensionOfNestedType($0)
|
||||
let hasDotInLocalName = type.localName.contains(".") as Bool
|
||||
if let _ = type.parent, hasDotInLocalName {
|
||||
resolveExtensionOfNestedType(type)
|
||||
}
|
||||
|
||||
if let resolved = resolveGlobalName(for: oldName, containingType: $0.parent, unique: typeMap, modules: modules, typealiases: resolvedTypealiases)?.name {
|
||||
$0.localName = resolved.replacingOccurrences(of: "\($0.module != nil ? "\($0.module!)." : "")", with: "")
|
||||
if let resolved = resolveGlobalName(for: oldName, containingType: type.parent, unique: typeMap, modules: modules, typealiases: resolvedTypealiases)?.name {
|
||||
var moduleName: String = ""
|
||||
if let module = type.module {
|
||||
moduleName = "\(module)."
|
||||
}
|
||||
type.localName = resolved.replacingOccurrences(of: moduleName, with: "")
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
// nothing left to do
|
||||
guard oldName != $0.globalName else {
|
||||
guard oldName != type.globalName else {
|
||||
return
|
||||
}
|
||||
|
||||
// if it had contained types, they might have been fully defined and so their name has to be noted in uniques
|
||||
func rewriteChildren(of type: Type) {
|
||||
// child is never an extension so no need to check
|
||||
for child in type.containedTypes {
|
||||
typeMap[child.globalName] = child
|
||||
rewriteChildren(of: child)
|
||||
}
|
||||
}
|
||||
rewriteChildren(of: $0)
|
||||
rewriteChildren(of: type)
|
||||
}
|
||||
|
||||
// extend all types with their extensions
|
||||
+8
-2
@@ -61,6 +61,8 @@ public class DiffableResult: NSObject, AutoEquatable {
|
||||
|
||||
var isEmpty: Bool { return results.isEmpty }
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.identifier)
|
||||
@@ -76,7 +78,9 @@ public class DiffableResult: NSObject, AutoEquatable {
|
||||
|
||||
public override var description: String {
|
||||
guard !results.isEmpty else { return "" }
|
||||
return "\(identifier.flatMap { "\($0) " } ?? "")" + results.joined(separator: "\n")
|
||||
var description = "\(identifier.flatMap { "\($0) " } ?? "")"
|
||||
description.append(results.joined(separator: "\n"))
|
||||
return description
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +101,9 @@ public extension DiffableResult {
|
||||
/// :nodoc:
|
||||
@discardableResult func trackDifference<T: Equatable>(actual: T?, expected: T?) -> DiffableResult {
|
||||
if actual != expected {
|
||||
let result = DiffableResult(results: ["<expected: \(expected.map({ "\($0)" }) ?? "nil"), received: \(actual.map({ "\($0)" }) ?? "nil")>"])
|
||||
let expected = expected.map({ "\($0)" }) ?? "nil"
|
||||
let actual = actual.map({ "\($0)" }) ?? "nil"
|
||||
let result = DiffableResult(results: ["<expected: \(expected), received: \(actual)>"])
|
||||
append(contentsOf: result)
|
||||
}
|
||||
return self
|
||||
+16
-8
@@ -189,29 +189,37 @@ public extension String {
|
||||
defer {
|
||||
i = self.index(i, offsetBy: offset)
|
||||
}
|
||||
let currentlyScanned = self[i..<(self.index(i, offsetBy: delimiter.count, limitedBy: self.endIndex) ?? self.endIndex)]
|
||||
if let openString = between.open.first(where: { String(self[i...]).starts(with: $0) }) {
|
||||
if !(boundingCharactersCount == 0 && String(self[i]) == delimiter) {
|
||||
var currentlyScannedEnd: Index = self.endIndex
|
||||
if let endIndex = self.index(i, offsetBy: delimiter.count, limitedBy: self.endIndex) {
|
||||
currentlyScannedEnd = endIndex
|
||||
}
|
||||
let currentlyScanned: String = String(self[i..<currentlyScannedEnd])
|
||||
if let openString = between.open.first(where: { self[i...].starts(with: $0) }) {
|
||||
if !((boundingCharactersCount == 0) as Bool && (String(self[i]) == delimiter) as Bool) {
|
||||
boundingCharactersCount += 1
|
||||
}
|
||||
offset = openString.count
|
||||
} else if let closeString = between.close.first(where: { String(self[i...]).starts(with: $0) }) {
|
||||
} else if let closeString = between.close.first(where: { self[i...].starts(with: $0) }) {
|
||||
// do not count `->`
|
||||
if !(self[i] == ">" && item.last == "-") {
|
||||
if !((self[i] == ">") as Bool && (item.last == "-") as Bool) {
|
||||
boundingCharactersCount = max(0, boundingCharactersCount - 1)
|
||||
}
|
||||
offset = closeString.count
|
||||
}
|
||||
if self[i] == "\"" {
|
||||
if (self[i] == "\"") as Bool {
|
||||
quotesCount += 1
|
||||
}
|
||||
|
||||
if currentlyScanned == delimiter && boundingCharactersCount == 0 && quotesCount % 2 == 0 {
|
||||
let currentIsDelimiter = (currentlyScanned == delimiter) as Bool
|
||||
let boundingCountIsZero = (boundingCharactersCount == 0) as Bool
|
||||
let hasEvenQuotes = (quotesCount % 2 == 0) as Bool
|
||||
if currentIsDelimiter && boundingCountIsZero && hasEvenQuotes {
|
||||
items.append(item)
|
||||
item = ""
|
||||
i = self.index(i, offsetBy: delimiter.count - 1)
|
||||
} else {
|
||||
item += self[i..<self.index(i, offsetBy: offset)]
|
||||
let endIndex: Index = self.index(i, offsetBy: offset)
|
||||
item += self[i..<endIndex]
|
||||
}
|
||||
}
|
||||
items.append(item)
|
||||
+13
-10
@@ -55,18 +55,19 @@ public final class FileParserResult: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "path = \(String(describing: self.path)), "
|
||||
string += "module = \(String(describing: self.module)), "
|
||||
string += "types = \(String(describing: self.types)), "
|
||||
string += "functions = \(String(describing: self.functions)), "
|
||||
string += "typealiases = \(String(describing: self.typealiases)), "
|
||||
string += "inlineRanges = \(String(describing: self.inlineRanges)), "
|
||||
string += "inlineIndentations = \(String(describing: self.inlineIndentations)), "
|
||||
string += "modifiedDate = \(String(describing: self.modifiedDate)), "
|
||||
string += "sourceryVersion = \(String(describing: self.sourceryVersion)), "
|
||||
string += "isEmpty = \(String(describing: self.isEmpty))"
|
||||
string.append("path = \(String(describing: self.path)), ")
|
||||
string.append("module = \(String(describing: self.module)), ")
|
||||
string.append("types = \(String(describing: self.types)), ")
|
||||
string.append("functions = \(String(describing: self.functions)), ")
|
||||
string.append("typealiases = \(String(describing: self.typealiases)), ")
|
||||
string.append("inlineRanges = \(String(describing: self.inlineRanges)), ")
|
||||
string.append("inlineIndentations = \(String(describing: self.inlineIndentations)), ")
|
||||
string.append("modifiedDate = \(String(describing: self.modifiedDate)), ")
|
||||
string.append("sourceryVersion = \(String(describing: self.sourceryVersion)), ")
|
||||
string.append("isEmpty = \(String(describing: self.isEmpty))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -88,6 +89,8 @@ public final class FileParserResult: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.path)
|
||||
+8
-5
@@ -72,13 +72,14 @@ public final class TemplateContext: NSObject, SourceryModel, NSCoding, Diffable
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "parserResult = \(String(describing: self.parserResult)), "
|
||||
string += "functions = \(String(describing: self.functions)), "
|
||||
string += "types = \(String(describing: self.types)), "
|
||||
string += "argument = \(String(describing: self.argument)), "
|
||||
string += "stencilContext = \(String(describing: self.stencilContext))"
|
||||
string.append("parserResult = \(String(describing: self.parserResult)), ")
|
||||
string.append("functions = \(String(describing: self.functions)), ")
|
||||
string.append("types = \(String(describing: self.types)), ")
|
||||
string.append("argument = \(String(describing: self.argument)), ")
|
||||
string.append("stencilContext = \(String(describing: self.stencilContext))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -95,6 +96,8 @@ public final class TemplateContext: NSObject, SourceryModel, NSCoding, Diffable
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.parserResult)
|
||||
@@ -1,4 +1,4 @@
|
||||
// Generated using Sourcery 2.1.3 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// Generated using Sourcery 2.1.7 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// DO NOT EDIT
|
||||
// swiftlint:disable vertical_whitespace trailing_newline
|
||||
|
||||
@@ -63,6 +63,8 @@ extension EnumCase: NSCoding {}
|
||||
|
||||
extension FileParserResult: NSCoding {}
|
||||
|
||||
extension GenericParameter: NSCoding {}
|
||||
|
||||
extension GenericRequirement: NSCoding {}
|
||||
|
||||
extension GenericType: NSCoding {}
|
||||
@@ -79,6 +81,8 @@ extension Modifier: NSCoding {}
|
||||
|
||||
|
||||
|
||||
extension SetType: NSCoding {}
|
||||
|
||||
|
||||
extension Subscript: NSCoding {}
|
||||
|
||||
@@ -96,4 +100,3 @@ extension Types: NSCoding {}
|
||||
|
||||
extension Variable: NSCoding {}
|
||||
|
||||
extension GenericParameter: NSCoding {}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Generated using Sourcery 2.1.3 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// Generated using Sourcery 2.1.7 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// DO NOT EDIT
|
||||
// swiftlint:disable vertical_whitespace trailing_newline
|
||||
|
||||
#if canImport(JavaScriptCore)
|
||||
import JavaScriptCore
|
||||
|
||||
@@ -48,6 +49,7 @@ import JavaScriptCore
|
||||
var supertype: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
var fileName: String? { get }
|
||||
}
|
||||
|
||||
@@ -145,6 +147,7 @@ extension BytesRange: BytesRangeAutoJSExport {}
|
||||
var supertype: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
var fileName: String? { get }
|
||||
}
|
||||
|
||||
@@ -156,6 +159,7 @@ extension Class: ClassAutoJSExport {}
|
||||
var typeName: TypeName { get }
|
||||
var `inout`: Bool { get }
|
||||
var type: Type? { get }
|
||||
var isVariadic: Bool { get }
|
||||
var typeAttributes: AttributeList { get }
|
||||
var defaultValue: String? { get }
|
||||
var annotations: Annotations { get }
|
||||
@@ -245,6 +249,7 @@ extension DictionaryType: DictionaryTypeAutoJSExport {}
|
||||
var supertype: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
var fileName: String? { get }
|
||||
}
|
||||
|
||||
@@ -263,6 +268,13 @@ extension Enum: EnumAutoJSExport {}
|
||||
extension EnumCase: EnumCaseAutoJSExport {}
|
||||
|
||||
|
||||
@objc protocol GenericParameterAutoJSExport: JSExport {
|
||||
var name: String { get }
|
||||
var inheritedTypeName: TypeName? { get }
|
||||
}
|
||||
|
||||
extension GenericParameter: GenericParameterAutoJSExport {}
|
||||
|
||||
@objc protocol GenericRequirementAutoJSExport: JSExport {
|
||||
var leftType: AssociatedType { get }
|
||||
var rightType: GenericTypeParameter { get }
|
||||
@@ -325,6 +337,7 @@ extension Import: ImportAutoJSExport {}
|
||||
var isGeneric: Bool { get }
|
||||
var isOptional: Bool { get }
|
||||
var isNonisolated: Bool { get }
|
||||
var isDynamic: Bool { get }
|
||||
var annotations: Annotations { get }
|
||||
var documentation: Documentation { get }
|
||||
var definedInTypeName: TypeName? { get }
|
||||
@@ -332,6 +345,7 @@ extension Import: ImportAutoJSExport {}
|
||||
var definedInType: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
}
|
||||
|
||||
extension Method: MethodAutoJSExport {}
|
||||
@@ -457,11 +471,22 @@ extension Protocol: ProtocolAutoJSExport {}
|
||||
var supertype: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
var fileName: String? { get }
|
||||
}
|
||||
|
||||
extension ProtocolComposition: ProtocolCompositionAutoJSExport {}
|
||||
|
||||
@objc protocol SetTypeAutoJSExport: JSExport {
|
||||
var name: String { get }
|
||||
var elementTypeName: TypeName { get }
|
||||
var elementType: Type? { get }
|
||||
var asGeneric: GenericType { get }
|
||||
var asSource: String { get }
|
||||
}
|
||||
|
||||
extension SetType: SetTypeAutoJSExport {}
|
||||
|
||||
|
||||
|
||||
@objc protocol StructAutoJSExport: JSExport {
|
||||
@@ -507,6 +532,7 @@ extension ProtocolComposition: ProtocolCompositionAutoJSExport {}
|
||||
var supertype: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
var fileName: String? { get }
|
||||
}
|
||||
|
||||
@@ -523,6 +549,8 @@ extension Struct: StructAutoJSExport {}
|
||||
var isFinal: Bool { get }
|
||||
var readAccess: String { get }
|
||||
var writeAccess: String { get }
|
||||
var isAsync: Bool { get }
|
||||
var `throws`: Bool { get }
|
||||
var isMutable: Bool { get }
|
||||
var annotations: Annotations { get }
|
||||
var documentation: Documentation { get }
|
||||
@@ -531,6 +559,9 @@ extension Struct: StructAutoJSExport {}
|
||||
var definedInType: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericParameters: [GenericParameter] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
var isGeneric: Bool { get }
|
||||
}
|
||||
|
||||
extension Subscript: SubscriptAutoJSExport {}
|
||||
@@ -608,6 +639,7 @@ extension TupleType: TupleTypeAutoJSExport {}
|
||||
var supertype: Type? { get }
|
||||
var attributes: AttributeList { get }
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var genericRequirements: [GenericRequirement] { get }
|
||||
var fileName: String? { get }
|
||||
}
|
||||
|
||||
@@ -633,6 +665,8 @@ extension Type: TypeAutoJSExport {}
|
||||
var dictionary: DictionaryType? { get }
|
||||
var isClosure: Bool { get }
|
||||
var closure: ClosureType? { get }
|
||||
var isSet: Bool { get }
|
||||
var set: SetType? { get }
|
||||
var asSource: String { get }
|
||||
var description: String { get }
|
||||
var debugDescription: String { get }
|
||||
@@ -645,6 +679,8 @@ extension TypeName: TypeNameAutoJSExport {}
|
||||
var typeName: TypeName { get }
|
||||
var type: Type? { get }
|
||||
var module: String? { get }
|
||||
var annotations: Annotations { get }
|
||||
var documentation: Documentation { get }
|
||||
var parent: Type? { get }
|
||||
var accessLevel: String { get }
|
||||
var parentName: String? { get }
|
||||
@@ -680,6 +716,7 @@ extension TypesCollection: TypesCollectionAutoJSExport {}
|
||||
var modifiers: [SourceryModifier] { get }
|
||||
var isFinal: Bool { get }
|
||||
var isLazy: Bool { get }
|
||||
var isDynamic: Bool { get }
|
||||
var definedInTypeName: TypeName? { get }
|
||||
var actualDefinedInTypeName: TypeName? { get }
|
||||
var definedInType: Type? { get }
|
||||
@@ -691,4 +728,4 @@ extension TypesCollection: TypesCollectionAutoJSExport {}
|
||||
extension Variable: VariableAutoJSExport {}
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
// Generated using Sourcery 2.1.3 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// Generated using Sourcery 2.1.7 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// DO NOT EDIT
|
||||
// swiftlint:disable vertical_whitespace
|
||||
|
||||
|
||||
+7
-8
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Describes Swift AssociatedType
|
||||
public final class AssociatedType: NSObject, SourceryModel, DynamicMemberLookup {
|
||||
public final class AssociatedType: NSObject, SourceryModel, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "name":
|
||||
@@ -38,10 +34,11 @@ public final class AssociatedType: NSObject, SourceryModel, DynamicMemberLookup
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -56,6 +53,8 @@ public final class AssociatedType: NSObject, SourceryModel, DynamicMemberLookup
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -75,7 +74,7 @@ public final class AssociatedType: NSObject, SourceryModel, DynamicMemberLookup
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
withVaList(["name"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+9
-10
@@ -4,13 +4,9 @@
|
||||
//
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Defines enum case associated value
|
||||
public final class AssociatedValue: NSObject, SourceryModel, AutoDescription, Typed, Annotated, Diffable, DynamicMemberLookup {
|
||||
public final class AssociatedValue: NSObject, SourceryModel, AutoDescription, Typed, Annotated, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "externalName":
|
||||
@@ -66,13 +62,14 @@ public final class AssociatedValue: NSObject, SourceryModel, AutoDescription, Ty
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "localName = \(String(describing: self.localName)), "
|
||||
string += "externalName = \(String(describing: self.externalName)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations))"
|
||||
string.append("localName = \(String(describing: self.localName)), ")
|
||||
string.append("externalName = \(String(describing: self.externalName)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -90,6 +87,8 @@ public final class AssociatedValue: NSObject, SourceryModel, AutoDescription, Ty
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.localName)
|
||||
+14
-15
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
// sourcery: skipDiffing
|
||||
public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated, DynamicMemberLookup {
|
||||
public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "argumentLabel":
|
||||
@@ -89,6 +85,8 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated,
|
||||
return (labels.nilIfEmpty ?? "_") + typeSuffix
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.argumentLabel)
|
||||
@@ -102,16 +100,17 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated,
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "argumentLabel = \(String(describing: self.argumentLabel)), "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "`inout` = \(String(describing: self.`inout`)), "
|
||||
string += "typeAttributes = \(String(describing: self.typeAttributes)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("argumentLabel = \(String(describing: self.argumentLabel)), ")
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("`inout` = \(String(describing: self.`inout`)), ")
|
||||
string.append("typeAttributes = \(String(describing: self.typeAttributes)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -141,8 +140,8 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated,
|
||||
fatalError()
|
||||
}; self.typeName = typeName
|
||||
self.`inout` = aDecoder.decode(forKey: "`inout`")
|
||||
self.isVariadic = aDecoder.decode(forKey: "isVariadic")
|
||||
self.type = aDecoder.decode(forKey: "type")
|
||||
self.isVariadic = aDecoder.decode(forKey: "isVariadic")
|
||||
self.defaultValue = aDecoder.decode(forKey: "defaultValue")
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
withVaList(["annotations"]) { arguments in
|
||||
@@ -158,8 +157,8 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated,
|
||||
aCoder.encode(self.name, forKey: "name")
|
||||
aCoder.encode(self.typeName, forKey: "typeName")
|
||||
aCoder.encode(self.`inout`, forKey: "`inout`")
|
||||
aCoder.encode(self.isVariadic, forKey: "isVariadic")
|
||||
aCoder.encode(self.type, forKey: "type")
|
||||
aCoder.encode(self.isVariadic, forKey: "isVariadic")
|
||||
aCoder.encode(self.defaultValue, forKey: "defaultValue")
|
||||
aCoder.encode(self.annotations, forKey: "annotations")
|
||||
}
|
||||
+11
-12
@@ -4,13 +4,9 @@
|
||||
//
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Defines enum case
|
||||
public final class EnumCase: NSObject, SourceryModel, AutoDescription, Annotated, Documented, Diffable, DynamicMemberLookup {
|
||||
public final class EnumCase: NSObject, SourceryModel, AutoDescription, Annotated, Documented, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "name":
|
||||
@@ -67,15 +63,16 @@ public final class EnumCase: NSObject, SourceryModel, AutoDescription, Annotated
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "rawValue = \(String(describing: self.rawValue)), "
|
||||
string += "associatedValues = \(String(describing: self.associatedValues)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "indirect = \(String(describing: self.indirect)), "
|
||||
string += "hasAssociatedValue = \(String(describing: self.hasAssociatedValue))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("rawValue = \(String(describing: self.rawValue)), ")
|
||||
string.append("associatedValues = \(String(describing: self.associatedValues)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("indirect = \(String(describing: self.indirect)), ")
|
||||
string.append("hasAssociatedValue = \(String(describing: self.hasAssociatedValue))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -94,6 +91,8 @@ public final class EnumCase: NSObject, SourceryModel, AutoDescription, Annotated
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+7
-4
@@ -101,12 +101,13 @@ public final class Enum: Type {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = super.description
|
||||
string += ", "
|
||||
string += "cases = \(String(describing: self.cases)), "
|
||||
string += "rawTypeName = \(String(describing: self.rawTypeName)), "
|
||||
string += "hasAssociatedValues = \(String(describing: self.hasAssociatedValues))"
|
||||
string.append(", ")
|
||||
string.append("cases = \(String(describing: self.cases)), ")
|
||||
string.append("rawTypeName = \(String(describing: self.rawTypeName)), ")
|
||||
string.append("hasAssociatedValues = \(String(describing: self.hasAssociatedValues))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -122,6 +123,8 @@ public final class Enum: Type {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.cases)
|
||||
+7
-8
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Descibes Swift generic parameter
|
||||
public final class GenericParameter: NSObject, SourceryModel, Diffable, DynamicMemberLookup {
|
||||
public final class GenericParameter: NSObject, SourceryModel, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "name":
|
||||
@@ -31,10 +27,11 @@ public final class GenericParameter: NSObject, SourceryModel, Diffable, DynamicM
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "inheritedTypeName = \(String(describing: self.inheritedTypeName))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("inheritedTypeName = \(String(describing: self.inheritedTypeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -49,6 +46,8 @@ public final class GenericParameter: NSObject, SourceryModel, Diffable, DynamicM
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -68,7 +67,7 @@ public final class GenericParameter: NSObject, SourceryModel, Diffable, DynamicM
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
withVaList(["name"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+12
-13
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Descibes Swift generic requirement
|
||||
public class GenericRequirement: NSObject, SourceryModel, Diffable, DynamicMemberLookup {
|
||||
public class GenericRequirement: NSObject, SourceryModel, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "leftType":
|
||||
@@ -53,12 +49,13 @@ public class GenericRequirement: NSObject, SourceryModel, Diffable, DynamicMembe
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "leftType = \(String(describing: self.leftType)), "
|
||||
string += "rightType = \(String(describing: self.rightType)), "
|
||||
string += "relationship = \(String(describing: self.relationship)), "
|
||||
string += "relationshipSyntax = \(String(describing: self.relationshipSyntax))"
|
||||
string.append("leftType = \(String(describing: self.leftType)), ")
|
||||
string.append("rightType = \(String(describing: self.rightType)), ")
|
||||
string.append("relationship = \(String(describing: self.relationship)), ")
|
||||
string.append("relationshipSyntax = \(String(describing: self.relationshipSyntax))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -75,6 +72,8 @@ public class GenericRequirement: NSObject, SourceryModel, Diffable, DynamicMembe
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.leftType)
|
||||
@@ -98,25 +97,25 @@ public class GenericRequirement: NSObject, SourceryModel, Diffable, DynamicMembe
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let leftType: AssociatedType = aDecoder.decode(forKey: "leftType") else {
|
||||
guard let leftType: AssociatedType = aDecoder.decode(forKey: "leftType") else {
|
||||
withVaList(["leftType"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.leftType = leftType
|
||||
guard let rightType: GenericTypeParameter = aDecoder.decode(forKey: "rightType") else {
|
||||
guard let rightType: GenericTypeParameter = aDecoder.decode(forKey: "rightType") else {
|
||||
withVaList(["rightType"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.rightType = rightType
|
||||
guard let relationship: String = aDecoder.decode(forKey: "relationship") else {
|
||||
guard let relationship: String = aDecoder.decode(forKey: "relationship") else {
|
||||
withVaList(["relationship"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.relationship = relationship
|
||||
guard let relationshipSyntax: String = aDecoder.decode(forKey: "relationshipSyntax") else {
|
||||
guard let relationshipSyntax: String = aDecoder.decode(forKey: "relationshipSyntax") else {
|
||||
withVaList(["relationshipSyntax"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+13
-14
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Describes method parameter
|
||||
public class MethodParameter: NSObject, SourceryModel, Typed, Annotated, Diffable, DynamicMemberLookup {
|
||||
public class MethodParameter: NSObject, SourceryModel, Typed, Annotated, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "argumentLabel":
|
||||
@@ -97,17 +93,18 @@ public class MethodParameter: NSObject, SourceryModel, Typed, Annotated, Diffabl
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "argumentLabel = \(String(describing: self.argumentLabel)), "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "`inout` = \(String(describing: self.`inout`)), "
|
||||
string += "isVariadic = \(String(describing: self.isVariadic)), "
|
||||
string += "typeAttributes = \(String(describing: self.typeAttributes)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("argumentLabel = \(String(describing: self.argumentLabel)), ")
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("`inout` = \(String(describing: self.`inout`)), ")
|
||||
string.append("isVariadic = \(String(describing: self.isVariadic)), ")
|
||||
string.append("typeAttributes = \(String(describing: self.typeAttributes)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -127,6 +124,8 @@ public class MethodParameter: NSObject, SourceryModel, Typed, Annotated, Diffabl
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.argumentLabel)
|
||||
+22
-23
@@ -1,15 +1,11 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// :nodoc:
|
||||
public typealias SourceryMethod = Method
|
||||
|
||||
/// Describes method
|
||||
public final class Method: NSObject, SourceryModel, Annotated, Documented, Definition, Diffable, DynamicMemberLookup {
|
||||
public final class Method: NSObject, SourceryModel, Annotated, Documented, Definition, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "definedInType":
|
||||
@@ -256,25 +252,26 @@ public final class Method: NSObject, SourceryModel, Annotated, Documented, Defin
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "selectorName = \(String(describing: self.selectorName)), "
|
||||
string += "parameters = \(String(describing: self.parameters)), "
|
||||
string += "returnTypeName = \(String(describing: self.returnTypeName)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "`throws` = \(String(describing: self.`throws`)), "
|
||||
string += "`rethrows` = \(String(describing: self.`rethrows`)), "
|
||||
string += "accessLevel = \(String(describing: self.accessLevel)), "
|
||||
string += "isStatic = \(String(describing: self.isStatic)), "
|
||||
string += "isClass = \(String(describing: self.isClass)), "
|
||||
string += "isFailableInitializer = \(String(describing: self.isFailableInitializer)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "definedInTypeName = \(String(describing: self.definedInTypeName)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
string += "modifiers = \(String(describing: self.modifiers))"
|
||||
string += "genericRequirements = \(String(describing: self.genericRequirements))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("selectorName = \(String(describing: self.selectorName)), ")
|
||||
string.append("parameters = \(String(describing: self.parameters)), ")
|
||||
string.append("returnTypeName = \(String(describing: self.returnTypeName)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("`throws` = \(String(describing: self.`throws`)), ")
|
||||
string.append("`rethrows` = \(String(describing: self.`rethrows`)), ")
|
||||
string.append("accessLevel = \(String(describing: self.accessLevel)), ")
|
||||
string.append("isStatic = \(String(describing: self.isStatic)), ")
|
||||
string.append("isClass = \(String(describing: self.isClass)), ")
|
||||
string.append("isFailableInitializer = \(String(describing: self.isFailableInitializer)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("definedInTypeName = \(String(describing: self.definedInTypeName)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers))")
|
||||
string.append("genericRequirements = \(String(describing: self.genericRequirements))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -304,6 +301,8 @@ public final class Method: NSObject, SourceryModel, Annotated, Documented, Defin
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -416,7 +415,7 @@ public final class Method: NSObject, SourceryModel, Annotated, Documented, Defin
|
||||
}
|
||||
fatalError()
|
||||
}; self.modifiers = modifiers
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+38
-39
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Describes subscript
|
||||
public final class Subscript: NSObject, SourceryModel, Annotated, Documented, Definition, Diffable, DynamicMemberLookup {
|
||||
public final class Subscript: NSObject, SourceryModel, Annotated, Documented, Definition, Diffable, SourceryDynamicMemberLookup {
|
||||
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
@@ -186,26 +182,27 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "parameters = \(String(describing: self.parameters)), "
|
||||
string += "returnTypeName = \(String(describing: self.returnTypeName)), "
|
||||
string += "actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), "
|
||||
string += "isFinal = \(String(describing: self.isFinal)), "
|
||||
string += "readAccess = \(String(describing: self.readAccess)), "
|
||||
string += "writeAccess = \(String(describing: self.writeAccess)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "`throws` = \(String(describing: self.throws)), "
|
||||
string += "isMutable = \(String(describing: self.isMutable)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "definedInTypeName = \(String(describing: self.definedInTypeName)), "
|
||||
string += "actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName)), "
|
||||
string += "genericParameters = \(String(describing: self.genericParameters)), "
|
||||
string += "genericRequirements = \(String(describing: self.genericRequirements)), "
|
||||
string += "isGeneric = \(String(describing: self.isGeneric)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
string += "modifiers = \(String(describing: self.modifiers))"
|
||||
string.append("parameters = \(String(describing: self.parameters)), ")
|
||||
string.append("returnTypeName = \(String(describing: self.returnTypeName)), ")
|
||||
string.append("actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), ")
|
||||
string.append("isFinal = \(String(describing: self.isFinal)), ")
|
||||
string.append("readAccess = \(String(describing: self.readAccess)), ")
|
||||
string.append("writeAccess = \(String(describing: self.writeAccess)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("`throws` = \(String(describing: self.throws)), ")
|
||||
string.append("isMutable = \(String(describing: self.isMutable)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("definedInTypeName = \(String(describing: self.definedInTypeName)), ")
|
||||
string.append("actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName)), ")
|
||||
string.append("genericParameters = \(String(describing: self.genericParameters)), ")
|
||||
string.append("genericRequirements = \(String(describing: self.genericRequirements)), ")
|
||||
string.append("isGeneric = \(String(describing: self.isGeneric)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -231,6 +228,8 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.parameters)
|
||||
@@ -272,71 +271,71 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let parameters: [MethodParameter] = aDecoder.decode(forKey: "parameters") else {
|
||||
guard let parameters: [MethodParameter] = aDecoder.decode(forKey: "parameters") else {
|
||||
withVaList(["parameters"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.parameters = parameters
|
||||
guard let returnTypeName: TypeName = aDecoder.decode(forKey: "returnTypeName") else {
|
||||
guard let returnTypeName: TypeName = aDecoder.decode(forKey: "returnTypeName") else {
|
||||
withVaList(["returnTypeName"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.returnTypeName = returnTypeName
|
||||
self.returnType = aDecoder.decode(forKey: "returnType")
|
||||
guard let readAccess: String = aDecoder.decode(forKey: "readAccess") else {
|
||||
guard let readAccess: String = aDecoder.decode(forKey: "readAccess") else {
|
||||
withVaList(["readAccess"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.readAccess = readAccess
|
||||
guard let writeAccess: String = aDecoder.decode(forKey: "writeAccess") else {
|
||||
guard let writeAccess: String = aDecoder.decode(forKey: "writeAccess") else {
|
||||
withVaList(["writeAccess"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.writeAccess = writeAccess
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
self.isAsync = aDecoder.decode(forKey: "isAsync")
|
||||
self.`throws` = aDecoder.decode(forKey: "`throws`")
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
withVaList(["annotations"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.annotations = annotations
|
||||
guard let documentation: Documentation = aDecoder.decode(forKey: "documentation") else {
|
||||
guard let documentation: Documentation = aDecoder.decode(forKey: "documentation") else {
|
||||
withVaList(["documentation"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.documentation = documentation
|
||||
self.isAsync = aDecoder.decode(forKey: "isAsync")
|
||||
self.`throws` = aDecoder.decode(forKey: "`throws`")
|
||||
self.definedInTypeName = aDecoder.decode(forKey: "definedInTypeName")
|
||||
self.definedInType = aDecoder.decode(forKey: "definedInType")
|
||||
guard let attributes: AttributeList = aDecoder.decode(forKey: "attributes") else {
|
||||
guard let attributes: AttributeList = aDecoder.decode(forKey: "attributes") else {
|
||||
withVaList(["attributes"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.attributes = attributes
|
||||
guard let modifiers: [SourceryModifier] = aDecoder.decode(forKey: "modifiers") else {
|
||||
guard let modifiers: [SourceryModifier] = aDecoder.decode(forKey: "modifiers") else {
|
||||
withVaList(["modifiers"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.modifiers = modifiers
|
||||
guard let genericParameters: [GenericParameter] = aDecoder.decode(forKey: "genericParameters") else {
|
||||
guard let genericParameters: [GenericParameter] = aDecoder.decode(forKey: "genericParameters") else {
|
||||
withVaList(["genericParameters"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericParameters = genericParameters
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
}; self.genericParameters = genericParameters
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericRequirements = genericRequirements
|
||||
}; self.genericRequirements = genericRequirements
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
@@ -352,10 +351,10 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
aCoder.encode(self.documentation, forKey: "documentation")
|
||||
aCoder.encode(self.definedInTypeName, forKey: "definedInTypeName")
|
||||
aCoder.encode(self.definedInType, forKey: "definedInType")
|
||||
aCoder.encode(self.genericParameters, forKey: "genericParameters")
|
||||
aCoder.encode(self.genericRequirements, forKey: "genericRequirements")
|
||||
aCoder.encode(self.attributes, forKey: "attributes")
|
||||
aCoder.encode(self.modifiers, forKey: "modifiers")
|
||||
aCoder.encode(self.genericParameters, forKey: "genericParameters")
|
||||
aCoder.encode(self.genericRequirements, forKey: "genericRequirements")
|
||||
}
|
||||
// sourcery:end
|
||||
|
||||
+14
-15
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
/// Describes closure type
|
||||
|
||||
public final class ClosureType: NSObject, SourceryModel, Diffable, DynamicMemberLookup {
|
||||
/// Describes closure type
|
||||
public final class ClosureType: NSObject, SourceryModel, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "name":
|
||||
@@ -102,17 +98,18 @@ public final class ClosureType: NSObject, SourceryModel, Diffable, DynamicMember
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "parameters = \(String(describing: self.parameters)), "
|
||||
string += "returnTypeName = \(String(describing: self.returnTypeName)), "
|
||||
string += "actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "asyncKeyword = \(String(describing: self.asyncKeyword)), "
|
||||
string += "`throws` = \(String(describing: self.`throws`)), "
|
||||
string += "throwsOrRethrowsKeyword = \(String(describing: self.throwsOrRethrowsKeyword)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("parameters = \(String(describing: self.parameters)), ")
|
||||
string.append("returnTypeName = \(String(describing: self.returnTypeName)), ")
|
||||
string.append("actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("asyncKeyword = \(String(describing: self.asyncKeyword)), ")
|
||||
string.append("`throws` = \(String(describing: self.`throws`)), ")
|
||||
string.append("throwsOrRethrowsKeyword = \(String(describing: self.throwsOrRethrowsKeyword)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -132,6 +129,8 @@ public final class ClosureType: NSObject, SourceryModel, Diffable, DynamicMember
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+6
-7
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Descibes Swift generic type parameter
|
||||
public final class GenericTypeParameter: NSObject, SourceryModel, Diffable, DynamicMemberLookup {
|
||||
public final class GenericTypeParameter: NSObject, SourceryModel, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "typeName":
|
||||
@@ -32,9 +28,10 @@ public final class GenericTypeParameter: NSObject, SourceryModel, Diffable, Dyna
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "typeName = \(String(describing: self.typeName))"
|
||||
string.append("typeName = \(String(describing: self.typeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -48,6 +45,8 @@ public final class GenericTypeParameter: NSObject, SourceryModel, Diffable, Dyna
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.typeName)
|
||||
@@ -65,7 +64,7 @@ public final class GenericTypeParameter: NSObject, SourceryModel, Diffable, Dyna
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let typeName: TypeName = aDecoder.decode(forKey: "typeName") else {
|
||||
guard let typeName: TypeName = aDecoder.decode(forKey: "typeName") else {
|
||||
withVaList(["typeName"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+13
-11
@@ -1,12 +1,8 @@
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Describes tuple type
|
||||
public final class TupleType: NSObject, SourceryModel, Diffable, DynamicMemberLookup {
|
||||
public final class TupleType: NSObject, SourceryModel, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "elements":
|
||||
@@ -35,10 +31,11 @@ public final class TupleType: NSObject, SourceryModel, Diffable, DynamicMemberLo
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "elements = \(String(describing: self.elements))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("elements = \(String(describing: self.elements))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -53,6 +50,8 @@ public final class TupleType: NSObject, SourceryModel, Diffable, DynamicMemberLo
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -95,7 +94,7 @@ public final class TupleType: NSObject, SourceryModel, Diffable, DynamicMemberLo
|
||||
}
|
||||
|
||||
/// Describes tuple type element
|
||||
public final class TupleElement: NSObject, SourceryModel, Typed, Diffable, DynamicMemberLookup {
|
||||
public final class TupleElement: NSObject, SourceryModel, Typed, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "name":
|
||||
@@ -132,11 +131,12 @@ public final class TupleElement: NSObject, SourceryModel, Typed, Diffable, Dynam
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -151,6 +151,8 @@ public final class TupleElement: NSObject, SourceryModel, Typed, Diffable, Dynam
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+3
-5
@@ -4,13 +4,9 @@
|
||||
//
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// Describes name of the type used in typed declaration (variable, method parameter or return value etc.)
|
||||
public final class TypeName: NSObject, SourceryModelWithoutDescription, LosslessStringConvertible, Diffable, DynamicMemberLookup {
|
||||
public final class TypeName: NSObject, SourceryModelWithoutDescription, LosslessStringConvertible, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "tuple":
|
||||
@@ -225,6 +221,8 @@ public final class TypeName: NSObject, SourceryModelWithoutDescription, Lossless
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+45
-46
@@ -4,16 +4,12 @@
|
||||
//
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// :nodoc:
|
||||
public typealias AttributeList = [String: [Attribute]]
|
||||
|
||||
/// Defines Swift type
|
||||
public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable, DynamicMemberLookup {
|
||||
public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "implements":
|
||||
@@ -473,41 +469,42 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable, Dyn
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "module = \(String(describing: self.module)), "
|
||||
string += "imports = \(String(describing: self.imports)), "
|
||||
string += "allImports = \(String(describing: self.allImports)), "
|
||||
string += "typealiases = \(String(describing: self.typealiases)), "
|
||||
string += "isExtension = \(String(describing: self.isExtension)), "
|
||||
string += "kind = \(String(describing: self.kind)), "
|
||||
string += "accessLevel = \(String(describing: self.accessLevel)), "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "isUnknownExtension = \(String(describing: self.isUnknownExtension)), "
|
||||
string += "isGeneric = \(String(describing: self.isGeneric)), "
|
||||
string += "localName = \(String(describing: self.localName)), "
|
||||
string += "rawVariables = \(String(describing: self.rawVariables)), "
|
||||
string += "rawMethods = \(String(describing: self.rawMethods)), "
|
||||
string += "rawSubscripts = \(String(describing: self.rawSubscripts)), "
|
||||
string += "initializers = \(String(describing: self.initializers)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "staticVariables = \(String(describing: self.staticVariables)), "
|
||||
string += "staticMethods = \(String(describing: self.staticMethods)), "
|
||||
string += "classMethods = \(String(describing: self.classMethods)), "
|
||||
string += "instanceVariables = \(String(describing: self.instanceVariables)), "
|
||||
string += "instanceMethods = \(String(describing: self.instanceMethods)), "
|
||||
string += "computedVariables = \(String(describing: self.computedVariables)), "
|
||||
string += "storedVariables = \(String(describing: self.storedVariables)), "
|
||||
string += "inheritedTypes = \(String(describing: self.inheritedTypes)), "
|
||||
string += "inherits = \(String(describing: self.inherits)), "
|
||||
string += "containedTypes = \(String(describing: self.containedTypes)), "
|
||||
string += "parentName = \(String(describing: self.parentName)), "
|
||||
string += "parentTypes = \(String(describing: self.parentTypes)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
string += "modifiers = \(String(describing: self.modifiers)), "
|
||||
string += "fileName = \(String(describing: self.fileName)), "
|
||||
string += "genericRequirements = \(String(describing: self.genericRequirements))"
|
||||
string.append("module = \(String(describing: self.module)), ")
|
||||
string.append("imports = \(String(describing: self.imports)), ")
|
||||
string.append("allImports = \(String(describing: self.allImports)), ")
|
||||
string.append("typealiases = \(String(describing: self.typealiases)), ")
|
||||
string.append("isExtension = \(String(describing: self.isExtension)), ")
|
||||
string.append("kind = \(String(describing: self.kind)), ")
|
||||
string.append("accessLevel = \(String(describing: self.accessLevel)), ")
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("isUnknownExtension = \(String(describing: self.isUnknownExtension)), ")
|
||||
string.append("isGeneric = \(String(describing: self.isGeneric)), ")
|
||||
string.append("localName = \(String(describing: self.localName)), ")
|
||||
string.append("rawVariables = \(String(describing: self.rawVariables)), ")
|
||||
string.append("rawMethods = \(String(describing: self.rawMethods)), ")
|
||||
string.append("rawSubscripts = \(String(describing: self.rawSubscripts)), ")
|
||||
string.append("initializers = \(String(describing: self.initializers)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("staticVariables = \(String(describing: self.staticVariables)), ")
|
||||
string.append("staticMethods = \(String(describing: self.staticMethods)), ")
|
||||
string.append("classMethods = \(String(describing: self.classMethods)), ")
|
||||
string.append("instanceVariables = \(String(describing: self.instanceVariables)), ")
|
||||
string.append("instanceMethods = \(String(describing: self.instanceMethods)), ")
|
||||
string.append("computedVariables = \(String(describing: self.computedVariables)), ")
|
||||
string.append("storedVariables = \(String(describing: self.storedVariables)), ")
|
||||
string.append("inheritedTypes = \(String(describing: self.inheritedTypes)), ")
|
||||
string.append("inherits = \(String(describing: self.inherits)), ")
|
||||
string.append("containedTypes = \(String(describing: self.containedTypes)), ")
|
||||
string.append("parentName = \(String(describing: self.parentName)), ")
|
||||
string.append("parentTypes = \(String(describing: self.parentTypes)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers)), ")
|
||||
string.append("fileName = \(String(describing: self.fileName)), ")
|
||||
string.append("genericRequirements = \(String(describing: self.genericRequirements))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -541,6 +538,8 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable, Dyn
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.module)
|
||||
@@ -621,13 +620,7 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable, Dyn
|
||||
fatalError()
|
||||
}; self.accessLevel = accessLevel
|
||||
self.isGeneric = aDecoder.decode(forKey: "isGeneric")
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericRequirements = genericRequirements
|
||||
guard let localName: String = aDecoder.decode(forKey: "localName") else {
|
||||
guard let localName: String = aDecoder.decode(forKey: "localName") else {
|
||||
withVaList(["localName"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
@@ -723,6 +716,12 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable, Dyn
|
||||
fatalError()
|
||||
}; self.modifiers = modifiers
|
||||
self.path = aDecoder.decode(forKey: "path")
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericRequirements = genericRequirements
|
||||
self.fileName = aDecoder.decode(forKey: "fileName")
|
||||
}
|
||||
|
||||
@@ -755,8 +754,8 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable, Dyn
|
||||
aCoder.encode(self.attributes, forKey: "attributes")
|
||||
aCoder.encode(self.modifiers, forKey: "modifiers")
|
||||
aCoder.encode(self.path, forKey: "path")
|
||||
aCoder.encode(self.fileName, forKey: "fileName")
|
||||
aCoder.encode(self.genericRequirements, forKey: "genericRequirements")
|
||||
aCoder.encode(self.fileName, forKey: "fileName")
|
||||
}
|
||||
// sourcery:end
|
||||
|
||||
+24
-25
@@ -4,16 +4,12 @@
|
||||
//
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// :nodoc:
|
||||
public typealias SourceryVariable = Variable
|
||||
|
||||
/// Defines variable
|
||||
public final class Variable: NSObject, SourceryModel, Typed, Annotated, Documented, Definition, Diffable, DynamicMemberLookup {
|
||||
public final class Variable: NSObject, SourceryModel, Typed, Annotated, Documented, Definition, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "readAccess":
|
||||
@@ -165,28 +161,29 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "isComputed = \(String(describing: self.isComputed)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "`throws` = \(String(describing: self.`throws`)), "
|
||||
string += "isStatic = \(String(describing: self.isStatic)), "
|
||||
string += "readAccess = \(String(describing: self.readAccess)), "
|
||||
string += "writeAccess = \(String(describing: self.writeAccess)), "
|
||||
string += "accessLevel = \(String(describing: self.accessLevel)), "
|
||||
string += "isMutable = \(String(describing: self.isMutable)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
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))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("isComputed = \(String(describing: self.isComputed)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("`throws` = \(String(describing: self.`throws`)), ")
|
||||
string.append("isStatic = \(String(describing: self.isStatic)), ")
|
||||
string.append("readAccess = \(String(describing: self.readAccess)), ")
|
||||
string.append("writeAccess = \(String(describing: self.writeAccess)), ")
|
||||
string.append("accessLevel = \(String(describing: self.accessLevel)), ")
|
||||
string.append("isMutable = \(String(describing: self.isMutable)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers)), ")
|
||||
string.append("isFinal = \(String(describing: self.isFinal)), ")
|
||||
string.append("isLazy = \(String(describing: self.isLazy)), ")
|
||||
string.append("isDynamic = \(String(describing: self.isDynamic)), ")
|
||||
string.append("definedInTypeName = \(String(describing: self.definedInTypeName)), ")
|
||||
string.append("actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -213,6 +210,8 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Stencil
|
||||
// Copyright © 2022 Stencil
|
||||
// MIT Licence
|
||||
//
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
#if canImport(Stencil)
|
||||
import Stencil
|
||||
#else
|
||||
// This is not supposed to work at all, since in Stencil there is a protocol conformance check against `DynamicMemberLookup`,
|
||||
// and, of course, a substitute with the "same name" but in `Sourcery` will never satisfy that check.
|
||||
// Here, we are just mimicking `Stencil.DynamicMemberLookup` to showcase what is happening within the `Sourcery` during runtime.
|
||||
|
||||
/// Marker protocol so we can know which types support `@dynamicMemberLookup`. Add this to your own types that support
|
||||
/// lookup by String.
|
||||
public protocol DynamicMemberLookup {
|
||||
/// Get a value for a given `String` key
|
||||
subscript(dynamicMember member: String) -> Any? { get }
|
||||
}
|
||||
|
||||
public extension DynamicMemberLookup where Self: RawRepresentable {
|
||||
/// Get a value for a given `String` key
|
||||
subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "rawValue":
|
||||
return rawValue
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public protocol SourceryDynamicMemberLookup: DynamicMemberLookup {}
|
||||
|
||||
#endif
|
||||
+1
-5
@@ -4,13 +4,9 @@
|
||||
//
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
/// :nodoc:
|
||||
public class TypesCollection: NSObject, AutoJSExport, DynamicMemberLookup {
|
||||
public class TypesCollection: NSObject, AutoJSExport, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
return try? types(forKey: member)
|
||||
}
|
||||
+6
-7
@@ -4,14 +4,10 @@
|
||||
//
|
||||
#if !canImport(ObjectiveC)
|
||||
import Foundation
|
||||
// For DynamicMemberLookup we need to import Stencil,
|
||||
// however, this is different from SourceryRuntime.content.generated.swift, because
|
||||
// it cannot reference Stencil
|
||||
import Stencil
|
||||
|
||||
// sourcery: skipJSExport
|
||||
/// Collection of scanned types for accessing in templates
|
||||
public final class Types: NSObject, SourceryModel, Diffable, DynamicMemberLookup {
|
||||
public final class Types: NSObject, SourceryModel, Diffable, SourceryDynamicMemberLookup {
|
||||
public subscript(dynamicMember member: String) -> Any? {
|
||||
switch member {
|
||||
case "types":
|
||||
@@ -52,10 +48,11 @@ public final class Types: NSObject, SourceryModel, Diffable, DynamicMemberLookup
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "types = \(String(describing: self.types)), "
|
||||
string += "typealiases = \(String(describing: self.typealiases))"
|
||||
string.append("types = \(String(describing: self.types)), ")
|
||||
string.append("typealiases = \(String(describing: self.typealiases))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -70,6 +67,8 @@ public final class Types: NSObject, SourceryModel, Diffable, DynamicMemberLookup
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.types)
|
||||
+5
-2
@@ -22,10 +22,11 @@ public final class AssociatedType: NSObject, SourceryModel {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -40,6 +41,8 @@ public final class AssociatedType: NSObject, SourceryModel {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+8
-5
@@ -45,13 +45,14 @@ public final class AssociatedValue: NSObject, SourceryModel, AutoDescription, Ty
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "localName = \(String(describing: self.localName)), "
|
||||
string += "externalName = \(String(describing: self.externalName)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations))"
|
||||
string.append("localName = \(String(describing: self.localName)), ")
|
||||
string.append("externalName = \(String(describing: self.externalName)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -69,6 +70,8 @@ public final class AssociatedValue: NSObject, SourceryModel, AutoDescription, Ty
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.localName)
|
||||
+13
-10
@@ -66,6 +66,8 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated {
|
||||
return (labels.nilIfEmpty ?? "_") + typeSuffix
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.argumentLabel)
|
||||
@@ -79,16 +81,17 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "argumentLabel = \(String(describing: self.argumentLabel)), "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "`inout` = \(String(describing: self.`inout`)), "
|
||||
string += "typeAttributes = \(String(describing: self.typeAttributes)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("argumentLabel = \(String(describing: self.argumentLabel)), ")
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("`inout` = \(String(describing: self.`inout`)), ")
|
||||
string.append("typeAttributes = \(String(describing: self.typeAttributes)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -118,8 +121,8 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated {
|
||||
fatalError()
|
||||
}; self.typeName = typeName
|
||||
self.`inout` = aDecoder.decode(forKey: "`inout`")
|
||||
self.isVariadic = aDecoder.decode(forKey: "isVariadic")
|
||||
self.type = aDecoder.decode(forKey: "type")
|
||||
self.isVariadic = aDecoder.decode(forKey: "isVariadic")
|
||||
self.defaultValue = aDecoder.decode(forKey: "defaultValue")
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
withVaList(["annotations"]) { arguments in
|
||||
@@ -135,8 +138,8 @@ public final class ClosureParameter: NSObject, SourceryModel, Typed, Annotated {
|
||||
aCoder.encode(self.name, forKey: "name")
|
||||
aCoder.encode(self.typeName, forKey: "typeName")
|
||||
aCoder.encode(self.`inout`, forKey: "`inout`")
|
||||
aCoder.encode(self.isVariadic, forKey: "isVariadic")
|
||||
aCoder.encode(self.type, forKey: "type")
|
||||
aCoder.encode(self.isVariadic, forKey: "isVariadic")
|
||||
aCoder.encode(self.defaultValue, forKey: "defaultValue")
|
||||
aCoder.encode(self.annotations, forKey: "annotations")
|
||||
}
|
||||
+7
-4
@@ -91,12 +91,13 @@ public final class Enum: Type {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = super.description
|
||||
string += ", "
|
||||
string += "cases = \(String(describing: self.cases)), "
|
||||
string += "rawTypeName = \(String(describing: self.rawTypeName)), "
|
||||
string += "hasAssociatedValues = \(String(describing: self.hasAssociatedValues))"
|
||||
string.append(", ")
|
||||
string.append("cases = \(String(describing: self.cases)), ")
|
||||
string.append("rawTypeName = \(String(describing: self.rawTypeName)), ")
|
||||
string.append("hasAssociatedValues = \(String(describing: self.hasAssociatedValues))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -112,6 +113,8 @@ public final class Enum: Type {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.cases)
|
||||
+10
-7
@@ -47,15 +47,16 @@ public final class EnumCase: NSObject, SourceryModel, AutoDescription, Annotated
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "rawValue = \(String(describing: self.rawValue)), "
|
||||
string += "associatedValues = \(String(describing: self.associatedValues)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "indirect = \(String(describing: self.indirect)), "
|
||||
string += "hasAssociatedValue = \(String(describing: self.hasAssociatedValue))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("rawValue = \(String(describing: self.rawValue)), ")
|
||||
string.append("associatedValues = \(String(describing: self.associatedValues)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("indirect = \(String(describing: self.indirect)), ")
|
||||
string.append("hasAssociatedValue = \(String(describing: self.hasAssociatedValue))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -74,6 +75,8 @@ public final class EnumCase: NSObject, SourceryModel, AutoDescription, Annotated
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+6
-3
@@ -18,10 +18,11 @@ public final class GenericParameter: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "inheritedTypeName = \(String(describing: self.inheritedTypeName))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("inheritedTypeName = \(String(describing: self.inheritedTypeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -36,6 +37,8 @@ public final class GenericParameter: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -55,7 +58,7 @@ public final class GenericParameter: NSObject, SourceryModel, Diffable {
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
guard let name: String = aDecoder.decode(forKey: "name") else {
|
||||
withVaList(["name"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+7
-4
@@ -36,12 +36,13 @@ public class GenericRequirement: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "leftType = \(String(describing: self.leftType)), "
|
||||
string += "rightType = \(String(describing: self.rightType)), "
|
||||
string += "relationship = \(String(describing: self.relationship)), "
|
||||
string += "relationshipSyntax = \(String(describing: self.relationshipSyntax))"
|
||||
string.append("leftType = \(String(describing: self.leftType)), ")
|
||||
string.append("rightType = \(String(describing: self.rightType)), ")
|
||||
string.append("relationship = \(String(describing: self.relationship)), ")
|
||||
string.append("relationshipSyntax = \(String(describing: self.relationshipSyntax))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -58,6 +59,8 @@ public class GenericRequirement: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.leftType)
|
||||
+21
-18
@@ -213,25 +213,26 @@ public final class Method: NSObject, SourceryModel, Annotated, Documented, Defin
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "selectorName = \(String(describing: self.selectorName)), "
|
||||
string += "parameters = \(String(describing: self.parameters)), "
|
||||
string += "returnTypeName = \(String(describing: self.returnTypeName)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "`throws` = \(String(describing: self.`throws`)), "
|
||||
string += "`rethrows` = \(String(describing: self.`rethrows`)), "
|
||||
string += "accessLevel = \(String(describing: self.accessLevel)), "
|
||||
string += "isStatic = \(String(describing: self.isStatic)), "
|
||||
string += "isClass = \(String(describing: self.isClass)), "
|
||||
string += "isFailableInitializer = \(String(describing: self.isFailableInitializer)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "definedInTypeName = \(String(describing: self.definedInTypeName)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
string += "modifiers = \(String(describing: self.modifiers)), "
|
||||
string += "genericRequirements = \(String(describing: self.genericRequirements))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("selectorName = \(String(describing: self.selectorName)), ")
|
||||
string.append("parameters = \(String(describing: self.parameters)), ")
|
||||
string.append("returnTypeName = \(String(describing: self.returnTypeName)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("`throws` = \(String(describing: self.`throws`)), ")
|
||||
string.append("`rethrows` = \(String(describing: self.`rethrows`)), ")
|
||||
string.append("accessLevel = \(String(describing: self.accessLevel)), ")
|
||||
string.append("isStatic = \(String(describing: self.isStatic)), ")
|
||||
string.append("isClass = \(String(describing: self.isClass)), ")
|
||||
string.append("isFailableInitializer = \(String(describing: self.isFailableInitializer)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("definedInTypeName = \(String(describing: self.definedInTypeName)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers)), ")
|
||||
string.append("genericRequirements = \(String(describing: self.genericRequirements))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -261,6 +262,8 @@ public final class Method: NSObject, SourceryModel, Annotated, Documented, Defin
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -373,7 +376,7 @@ public final class Method: NSObject, SourceryModel, Annotated, Documented, Defin
|
||||
}
|
||||
fatalError()
|
||||
}; self.modifiers = modifiers
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+16
-10
@@ -61,7 +61,10 @@ public class MethodParameter: NSObject, SourceryModel, Typed, Annotated, Diffabl
|
||||
}
|
||||
|
||||
public var asSource: String {
|
||||
let typeSuffix = ": \(`inout` ? "inout " : "")\(typeName.asSource)\(defaultValue.map { " = \($0)" } ?? "")" + (isVariadic ? "..." : "")
|
||||
let values: String = defaultValue.map { " = \($0)" } ?? ""
|
||||
let variadicity: String = isVariadic ? "..." : ""
|
||||
let inoutness: String = `inout` ? "inout " : ""
|
||||
let typeSuffix = ": \(inoutness)\(typeName.asSource)\(values)\(variadicity)"
|
||||
guard argumentLabel != name else {
|
||||
return name + typeSuffix
|
||||
}
|
||||
@@ -74,17 +77,18 @@ public class MethodParameter: NSObject, SourceryModel, Typed, Annotated, Diffabl
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "argumentLabel = \(String(describing: self.argumentLabel)), "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "`inout` = \(String(describing: self.`inout`)), "
|
||||
string += "isVariadic = \(String(describing: self.isVariadic)), "
|
||||
string += "typeAttributes = \(String(describing: self.typeAttributes)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("argumentLabel = \(String(describing: self.argumentLabel)), ")
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("`inout` = \(String(describing: self.`inout`)), ")
|
||||
string.append("isVariadic = \(String(describing: self.isVariadic)), ")
|
||||
string.append("typeAttributes = \(String(describing: self.typeAttributes)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -104,6 +108,8 @@ public class MethodParameter: NSObject, SourceryModel, Typed, Annotated, Diffabl
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.argumentLabel)
|
||||
+37
-34
@@ -131,26 +131,27 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "parameters = \(String(describing: self.parameters)), "
|
||||
string += "returnTypeName = \(String(describing: self.returnTypeName)), "
|
||||
string += "actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), "
|
||||
string += "isFinal = \(String(describing: self.isFinal)), "
|
||||
string += "readAccess = \(String(describing: self.readAccess)), "
|
||||
string += "writeAccess = \(String(describing: self.writeAccess)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "`throws` = \(String(describing: self.throws)), "
|
||||
string += "isMutable = \(String(describing: self.isMutable)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "definedInTypeName = \(String(describing: self.definedInTypeName)), "
|
||||
string += "actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName)), "
|
||||
string += "genericParameters = \(String(describing: self.genericParameters)), "
|
||||
string += "genericRequirements = \(String(describing: self.genericRequirements)), "
|
||||
string += "isGeneric = \(String(describing: self.isGeneric)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
string += "modifiers = \(String(describing: self.modifiers))"
|
||||
string.append("parameters = \(String(describing: self.parameters)), ")
|
||||
string.append("returnTypeName = \(String(describing: self.returnTypeName)), ")
|
||||
string.append("actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), ")
|
||||
string.append("isFinal = \(String(describing: self.isFinal)), ")
|
||||
string.append("readAccess = \(String(describing: self.readAccess)), ")
|
||||
string.append("writeAccess = \(String(describing: self.writeAccess)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("`throws` = \(String(describing: self.throws)), ")
|
||||
string.append("isMutable = \(String(describing: self.isMutable)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("definedInTypeName = \(String(describing: self.definedInTypeName)), ")
|
||||
string.append("actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName)), ")
|
||||
string.append("genericParameters = \(String(describing: self.genericParameters)), ")
|
||||
string.append("genericRequirements = \(String(describing: self.genericRequirements)), ")
|
||||
string.append("isGeneric = \(String(describing: self.isGeneric)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -176,6 +177,8 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.parameters)
|
||||
@@ -217,71 +220,71 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let parameters: [MethodParameter] = aDecoder.decode(forKey: "parameters") else {
|
||||
guard let parameters: [MethodParameter] = aDecoder.decode(forKey: "parameters") else {
|
||||
withVaList(["parameters"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.parameters = parameters
|
||||
guard let returnTypeName: TypeName = aDecoder.decode(forKey: "returnTypeName") else {
|
||||
guard let returnTypeName: TypeName = aDecoder.decode(forKey: "returnTypeName") else {
|
||||
withVaList(["returnTypeName"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.returnTypeName = returnTypeName
|
||||
self.returnType = aDecoder.decode(forKey: "returnType")
|
||||
guard let readAccess: String = aDecoder.decode(forKey: "readAccess") else {
|
||||
guard let readAccess: String = aDecoder.decode(forKey: "readAccess") else {
|
||||
withVaList(["readAccess"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.readAccess = readAccess
|
||||
guard let writeAccess: String = aDecoder.decode(forKey: "writeAccess") else {
|
||||
guard let writeAccess: String = aDecoder.decode(forKey: "writeAccess") else {
|
||||
withVaList(["writeAccess"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.writeAccess = writeAccess
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
self.isAsync = aDecoder.decode(forKey: "isAsync")
|
||||
self.`throws` = aDecoder.decode(forKey: "`throws`")
|
||||
guard let annotations: Annotations = aDecoder.decode(forKey: "annotations") else {
|
||||
withVaList(["annotations"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.annotations = annotations
|
||||
guard let documentation: Documentation = aDecoder.decode(forKey: "documentation") else {
|
||||
guard let documentation: Documentation = aDecoder.decode(forKey: "documentation") else {
|
||||
withVaList(["documentation"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.documentation = documentation
|
||||
self.isAsync = aDecoder.decode(forKey: "isAsync")
|
||||
self.`throws` = aDecoder.decode(forKey: "`throws`")
|
||||
self.definedInTypeName = aDecoder.decode(forKey: "definedInTypeName")
|
||||
self.definedInType = aDecoder.decode(forKey: "definedInType")
|
||||
guard let attributes: AttributeList = aDecoder.decode(forKey: "attributes") else {
|
||||
guard let attributes: AttributeList = aDecoder.decode(forKey: "attributes") else {
|
||||
withVaList(["attributes"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.attributes = attributes
|
||||
guard let modifiers: [SourceryModifier] = aDecoder.decode(forKey: "modifiers") else {
|
||||
guard let modifiers: [SourceryModifier] = aDecoder.decode(forKey: "modifiers") else {
|
||||
withVaList(["modifiers"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.modifiers = modifiers
|
||||
guard let genericParameters: [GenericParameter] = aDecoder.decode(forKey: "genericParameters") else {
|
||||
guard let genericParameters: [GenericParameter] = aDecoder.decode(forKey: "genericParameters") else {
|
||||
withVaList(["genericParameters"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericParameters = genericParameters
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
}; self.genericParameters = genericParameters
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericRequirements = genericRequirements
|
||||
}; self.genericRequirements = genericRequirements
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
@@ -297,10 +300,10 @@ public final class Subscript: NSObject, SourceryModel, Annotated, Documented, De
|
||||
aCoder.encode(self.documentation, forKey: "documentation")
|
||||
aCoder.encode(self.definedInTypeName, forKey: "definedInTypeName")
|
||||
aCoder.encode(self.definedInType, forKey: "definedInType")
|
||||
aCoder.encode(self.genericParameters, forKey: "genericParameters")
|
||||
aCoder.encode(self.genericRequirements, forKey: "genericRequirements")
|
||||
aCoder.encode(self.attributes, forKey: "attributes")
|
||||
aCoder.encode(self.modifiers, forKey: "modifiers")
|
||||
aCoder.encode(self.genericParameters, forKey: "genericParameters")
|
||||
aCoder.encode(self.genericRequirements, forKey: "genericRequirements")
|
||||
}
|
||||
// sourcery:end
|
||||
|
||||
+46
-43
@@ -4,7 +4,6 @@
|
||||
//
|
||||
#if canImport(ObjectiveC)
|
||||
import Foundation
|
||||
import Stencil
|
||||
|
||||
/// :nodoc:
|
||||
public typealias AttributeList = [String: [Attribute]]
|
||||
@@ -426,41 +425,43 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "module = \(String(describing: self.module)), "
|
||||
string += "imports = \(String(describing: self.imports)), "
|
||||
string += "allImports = \(String(describing: self.allImports)), "
|
||||
string += "typealiases = \(String(describing: self.typealiases)), "
|
||||
string += "isExtension = \(String(describing: self.isExtension)), "
|
||||
string += "kind = \(String(describing: self.kind)), "
|
||||
string += "accessLevel = \(String(describing: self.accessLevel)), "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "isUnknownExtension = \(String(describing: self.isUnknownExtension)), "
|
||||
string += "isGeneric = \(String(describing: self.isGeneric)), "
|
||||
string += "localName = \(String(describing: self.localName)), "
|
||||
string += "rawVariables = \(String(describing: self.rawVariables)), "
|
||||
string += "rawMethods = \(String(describing: self.rawMethods)), "
|
||||
string += "rawSubscripts = \(String(describing: self.rawSubscripts)), "
|
||||
string += "initializers = \(String(describing: self.initializers)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "staticVariables = \(String(describing: self.staticVariables)), "
|
||||
string += "staticMethods = \(String(describing: self.staticMethods)), "
|
||||
string += "classMethods = \(String(describing: self.classMethods)), "
|
||||
string += "instanceVariables = \(String(describing: self.instanceVariables)), "
|
||||
string += "instanceMethods = \(String(describing: self.instanceMethods)), "
|
||||
string += "computedVariables = \(String(describing: self.computedVariables)), "
|
||||
string += "storedVariables = \(String(describing: self.storedVariables)), "
|
||||
string += "inheritedTypes = \(String(describing: self.inheritedTypes)), "
|
||||
string += "inherits = \(String(describing: self.inherits)), "
|
||||
string += "containedTypes = \(String(describing: self.containedTypes)), "
|
||||
string += "parentName = \(String(describing: self.parentName)), "
|
||||
string += "parentTypes = \(String(describing: self.parentTypes)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
string += "modifiers = \(String(describing: self.modifiers)), "
|
||||
string += "fileName = \(String(describing: self.fileName)), "
|
||||
string += "genericRequirements = \(String(describing: self.genericRequirements))"
|
||||
let type: Type.Type = Swift.type(of: self)
|
||||
var string = "\(type): "
|
||||
string.append("module = \(String(describing: self.module)), ")
|
||||
string.append("imports = \(String(describing: self.imports)), ")
|
||||
string.append("allImports = \(String(describing: self.allImports)), ")
|
||||
string.append("typealiases = \(String(describing: self.typealiases)), ")
|
||||
string.append("isExtension = \(String(describing: self.isExtension)), ")
|
||||
string.append("kind = \(String(describing: self.kind)), ")
|
||||
string.append("accessLevel = \(String(describing: self.accessLevel)), ")
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("isUnknownExtension = \(String(describing: self.isUnknownExtension)), ")
|
||||
string.append("isGeneric = \(String(describing: self.isGeneric)), ")
|
||||
string.append("localName = \(String(describing: self.localName)), ")
|
||||
string.append("rawVariables = \(String(describing: self.rawVariables)), ")
|
||||
string.append("rawMethods = \(String(describing: self.rawMethods)), ")
|
||||
string.append("rawSubscripts = \(String(describing: self.rawSubscripts)), ")
|
||||
string.append("initializers = \(String(describing: self.initializers)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("staticVariables = \(String(describing: self.staticVariables)), ")
|
||||
string.append("staticMethods = \(String(describing: self.staticMethods)), ")
|
||||
string.append("classMethods = \(String(describing: self.classMethods)), ")
|
||||
string.append("instanceVariables = \(String(describing: self.instanceVariables)), ")
|
||||
string.append("instanceMethods = \(String(describing: self.instanceMethods)), ")
|
||||
string.append("computedVariables = \(String(describing: self.computedVariables)), ")
|
||||
string.append("storedVariables = \(String(describing: self.storedVariables)), ")
|
||||
string.append("inheritedTypes = \(String(describing: self.inheritedTypes)), ")
|
||||
string.append("inherits = \(String(describing: self.inherits)), ")
|
||||
string.append("containedTypes = \(String(describing: self.containedTypes)), ")
|
||||
string.append("parentName = \(String(describing: self.parentName)), ")
|
||||
string.append("parentTypes = \(String(describing: self.parentTypes)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers)), ")
|
||||
string.append("fileName = \(String(describing: self.fileName)), ")
|
||||
string.append("genericRequirements = \(String(describing: self.genericRequirements))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -494,6 +495,8 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.module)
|
||||
@@ -574,13 +577,7 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable {
|
||||
fatalError()
|
||||
}; self.accessLevel = accessLevel
|
||||
self.isGeneric = aDecoder.decode(forKey: "isGeneric")
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericRequirements = genericRequirements
|
||||
guard let localName: String = aDecoder.decode(forKey: "localName") else {
|
||||
guard let localName: String = aDecoder.decode(forKey: "localName") else {
|
||||
withVaList(["localName"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
@@ -676,6 +673,12 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable {
|
||||
fatalError()
|
||||
}; self.modifiers = modifiers
|
||||
self.path = aDecoder.decode(forKey: "path")
|
||||
guard let genericRequirements: [GenericRequirement] = aDecoder.decode(forKey: "genericRequirements") else {
|
||||
withVaList(["genericRequirements"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
fatalError()
|
||||
}; self.genericRequirements = genericRequirements
|
||||
self.fileName = aDecoder.decode(forKey: "fileName")
|
||||
}
|
||||
|
||||
@@ -708,8 +711,8 @@ public class Type: NSObject, SourceryModel, Annotated, Documented, Diffable {
|
||||
aCoder.encode(self.attributes, forKey: "attributes")
|
||||
aCoder.encode(self.modifiers, forKey: "modifiers")
|
||||
aCoder.encode(self.path, forKey: "path")
|
||||
aCoder.encode(self.fileName, forKey: "fileName")
|
||||
aCoder.encode(self.genericRequirements, forKey: "genericRequirements")
|
||||
aCoder.encode(self.fileName, forKey: "fileName")
|
||||
}
|
||||
// sourcery:end
|
||||
|
||||
+12
-9
@@ -70,17 +70,18 @@ public final class ClosureType: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "parameters = \(String(describing: self.parameters)), "
|
||||
string += "returnTypeName = \(String(describing: self.returnTypeName)), "
|
||||
string += "actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "asyncKeyword = \(String(describing: self.asyncKeyword)), "
|
||||
string += "`throws` = \(String(describing: self.`throws`)), "
|
||||
string += "throwsOrRethrowsKeyword = \(String(describing: self.throwsOrRethrowsKeyword)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("parameters = \(String(describing: self.parameters)), ")
|
||||
string.append("returnTypeName = \(String(describing: self.returnTypeName)), ")
|
||||
string.append("actualReturnTypeName = \(String(describing: self.actualReturnTypeName)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("asyncKeyword = \(String(describing: self.asyncKeyword)), ")
|
||||
string.append("`throws` = \(String(describing: self.`throws`)), ")
|
||||
string.append("throwsOrRethrowsKeyword = \(String(describing: self.throwsOrRethrowsKeyword)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -100,6 +101,8 @@ public final class ClosureType: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+5
-2
@@ -19,9 +19,10 @@ public final class GenericTypeParameter: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "typeName = \(String(describing: self.typeName))"
|
||||
string.append("typeName = \(String(describing: self.typeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -35,6 +36,8 @@ public final class GenericTypeParameter: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.typeName)
|
||||
@@ -52,7 +55,7 @@ public final class GenericTypeParameter: NSObject, SourceryModel, Diffable {
|
||||
|
||||
/// :nodoc:
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
guard let typeName: TypeName = aDecoder.decode(forKey: "typeName") else {
|
||||
guard let typeName: TypeName = aDecoder.decode(forKey: "typeName") else {
|
||||
withVaList(["typeName"]) { arguments in
|
||||
NSException.raise(NSExceptionName.parseErrorException, format: "Key '%@' not found.", arguments: arguments)
|
||||
}
|
||||
+11
-5
@@ -24,10 +24,11 @@ public final class TupleType: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "elements = \(String(describing: self.elements))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("elements = \(String(describing: self.elements))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -42,6 +43,8 @@ public final class TupleType: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -110,11 +113,12 @@ public final class TupleElement: NSObject, SourceryModel, Typed, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "asSource = \(String(describing: self.asSource))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("asSource = \(String(describing: self.asSource))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -129,6 +133,8 @@ public final class TupleElement: NSObject, SourceryModel, Typed, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+19
-16
@@ -25,7 +25,9 @@ public final class TypeName: NSObject, SourceryModelWithoutDescription, Lossless
|
||||
|
||||
let optionalSuffix: String
|
||||
// TODO: TBR
|
||||
if !name.hasPrefix("Optional<") && !name.contains(" where ") {
|
||||
let hasPrefix: Bool = name.hasPrefix("Optional<") as Bool
|
||||
let containsName: Bool = name.contains(" where ") as Bool
|
||||
if !hasPrefix && !containsName {
|
||||
if isOptional {
|
||||
optionalSuffix = "?"
|
||||
} else if isImplicitlyUnwrappedOptional {
|
||||
@@ -139,24 +141,25 @@ public final class TypeName: NSObject, SourceryModelWithoutDescription, Lossless
|
||||
/// Prints typename as it would appear on definition
|
||||
public var asSource: String {
|
||||
// TODO: TBR special treatment
|
||||
let specialTreatment = isOptional && name.hasPrefix("Optional<")
|
||||
let specialTreatment: Bool = isOptional && name.hasPrefix("Optional<")
|
||||
|
||||
var description = (
|
||||
attributes.flatMap({ $0.value }).map({ $0.asSource }).sorted() +
|
||||
modifiers.map({ $0.asSource }) +
|
||||
[specialTreatment ? name : unwrappedTypeName]
|
||||
).joined(separator: " ")
|
||||
let attributeValues: [Attribute] = attributes.flatMap { $0.value }
|
||||
let attributeValuesUnsorted: [String] = attributeValues.map { $0.asSource }
|
||||
var attributes: [String] = attributeValuesUnsorted.sorted()
|
||||
attributes.append(contentsOf: modifiers.map({ $0.asSource }))
|
||||
attributes.append(contentsOf: [specialTreatment ? name : unwrappedTypeName])
|
||||
var description = attributes.joined(separator: " ")
|
||||
|
||||
if let _ = self.dictionary { // array and dictionary cases are covered by the unwrapped type name
|
||||
// if let _ = self.dictionary { // array and dictionary cases are covered by the unwrapped type name
|
||||
// description.append(dictionary.asSource)
|
||||
} else if let _ = self.array {
|
||||
// } else if let _ = self.array {
|
||||
// description.append(array.asSource)
|
||||
} else if let _ = self.generic {
|
||||
// } else if let _ = self.generic {
|
||||
// let arguments = generic.typeParameters
|
||||
// .map({ $0.typeName.asSource })
|
||||
// .joined(separator: ", ")
|
||||
// description.append("<\(arguments)>")
|
||||
}
|
||||
// }
|
||||
if !specialTreatment {
|
||||
if isImplicitlyUnwrappedOptional {
|
||||
description.append("!")
|
||||
@@ -169,11 +172,10 @@ public final class TypeName: NSObject, SourceryModelWithoutDescription, Lossless
|
||||
}
|
||||
|
||||
public override var description: String {
|
||||
(
|
||||
attributes.flatMap({ $0.value }).map({ $0.asSource }).sorted() +
|
||||
modifiers.map({ $0.asSource }) +
|
||||
[name]
|
||||
).joined(separator: " ")
|
||||
var description: [String] = attributes.flatMap({ $0.value }).map({ $0.asSource }).sorted()
|
||||
description.append(contentsOf: modifiers.map({ $0.asSource }))
|
||||
description.append(contentsOf: [name])
|
||||
return description.joined(separator: " ")
|
||||
}
|
||||
|
||||
public func diffAgainst(_ object: Any?) -> DiffableResult {
|
||||
@@ -195,6 +197,7 @@ public final class TypeName: NSObject, SourceryModelWithoutDescription, Lossless
|
||||
return results
|
||||
}
|
||||
|
||||
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
+23
-21
@@ -4,7 +4,6 @@
|
||||
//
|
||||
#if canImport(ObjectiveC)
|
||||
import Foundation
|
||||
import Stencil
|
||||
|
||||
/// :nodoc:
|
||||
public typealias SourceryVariable = Variable
|
||||
@@ -131,28 +130,29 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "name = \(String(describing: self.name)), "
|
||||
string += "typeName = \(String(describing: self.typeName)), "
|
||||
string += "isComputed = \(String(describing: self.isComputed)), "
|
||||
string += "isAsync = \(String(describing: self.isAsync)), "
|
||||
string += "`throws` = \(String(describing: self.`throws`)), "
|
||||
string += "isStatic = \(String(describing: self.isStatic)), "
|
||||
string += "readAccess = \(String(describing: self.readAccess)), "
|
||||
string += "writeAccess = \(String(describing: self.writeAccess)), "
|
||||
string += "accessLevel = \(String(describing: self.accessLevel)), "
|
||||
string += "isMutable = \(String(describing: self.isMutable)), "
|
||||
string += "defaultValue = \(String(describing: self.defaultValue)), "
|
||||
string += "annotations = \(String(describing: self.annotations)), "
|
||||
string += "documentation = \(String(describing: self.documentation)), "
|
||||
string += "attributes = \(String(describing: self.attributes)), "
|
||||
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))"
|
||||
string.append("name = \(String(describing: self.name)), ")
|
||||
string.append("typeName = \(String(describing: self.typeName)), ")
|
||||
string.append("isComputed = \(String(describing: self.isComputed)), ")
|
||||
string.append("isAsync = \(String(describing: self.isAsync)), ")
|
||||
string.append("`throws` = \(String(describing: self.`throws`)), ")
|
||||
string.append("isStatic = \(String(describing: self.isStatic)), ")
|
||||
string.append("readAccess = \(String(describing: self.readAccess)), ")
|
||||
string.append("writeAccess = \(String(describing: self.writeAccess)), ")
|
||||
string.append("accessLevel = \(String(describing: self.accessLevel)), ")
|
||||
string.append("isMutable = \(String(describing: self.isMutable)), ")
|
||||
string.append("defaultValue = \(String(describing: self.defaultValue)), ")
|
||||
string.append("annotations = \(String(describing: self.annotations)), ")
|
||||
string.append("documentation = \(String(describing: self.documentation)), ")
|
||||
string.append("attributes = \(String(describing: self.attributes)), ")
|
||||
string.append("modifiers = \(String(describing: self.modifiers)), ")
|
||||
string.append("isFinal = \(String(describing: self.isFinal)), ")
|
||||
string.append("isLazy = \(String(describing: self.isLazy)), ")
|
||||
string.append("isDynamic = \(String(describing: self.isDynamic)), ")
|
||||
string.append("definedInTypeName = \(String(describing: self.definedInTypeName)), ")
|
||||
string.append("actualDefinedInTypeName = \(String(describing: self.actualDefinedInTypeName))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -180,6 +180,8 @@ public final class Variable: NSObject, SourceryModel, Typed, Annotated, Document
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.name)
|
||||
@@ -24,10 +24,11 @@ public final class Types: NSObject, SourceryModel, Diffable {
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
override public var description: String {
|
||||
var string = "\(Swift.type(of: self)): "
|
||||
string += "types = \(String(describing: self.types)), "
|
||||
string += "typealiases = \(String(describing: self.typealiases))"
|
||||
string.append("types = \(String(describing: self.types)), ")
|
||||
string.append("typealiases = \(String(describing: self.typealiases))")
|
||||
return string
|
||||
}
|
||||
|
||||
@@ -42,6 +43,8 @@ public final class Types: NSObject, SourceryModel, Diffable {
|
||||
return results
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
// sourcery: skipJSExport
|
||||
public override var hash: Int {
|
||||
var hasher = Hasher()
|
||||
hasher.combine(self.types)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
// Generated using Sourcery 2.1.3 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// Generated using Sourcery 2.1.7 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// DO NOT EDIT
|
||||
import Quick
|
||||
import Nimble
|
||||
@@ -27,6 +27,7 @@ class TypedSpec: QuickSpec {
|
||||
let variable = result?.types.first?.variables.first
|
||||
return variable?.typeName ?? TypeName(name: "")
|
||||
}
|
||||
|
||||
#if canImport(ObjectiveC)
|
||||
it("can report optional via KVC") {
|
||||
expect(AssociatedValue(typeName: typeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
|
||||
@@ -140,6 +141,7 @@ class TypedSpec: QuickSpec {
|
||||
let variable = result?.types.first?.variables.first
|
||||
return variable?.typeName ?? TypeName(name: "")
|
||||
}
|
||||
|
||||
#if canImport(ObjectiveC)
|
||||
it("can report optional via KVC") {
|
||||
expect(MethodParameter(typeName: typeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
|
||||
@@ -196,6 +198,7 @@ class TypedSpec: QuickSpec {
|
||||
let variable = result?.types.first?.variables.first
|
||||
return variable?.typeName ?? TypeName(name: "")
|
||||
}
|
||||
|
||||
#if canImport(ObjectiveC)
|
||||
it("can report optional via KVC") {
|
||||
expect(TupleElement(typeName: typeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
|
||||
@@ -309,6 +312,7 @@ class TypedSpec: QuickSpec {
|
||||
let variable = result?.types.first?.variables.first
|
||||
return variable?.typeName ?? TypeName(name: "")
|
||||
}
|
||||
|
||||
#if canImport(ObjectiveC)
|
||||
it("can report optional via KVC") {
|
||||
expect(Variable(typeName: typeName("Int?")).value(forKeyPath: "isOptional") as? Bool).to(equal(true))
|
||||
|
||||
Reference in New Issue
Block a user