Skip to content

Commit

Permalink
remove unnecessary init argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sidepelican committed Nov 6, 2024
1 parent 7676296 commit 7f3bc87
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
3 changes: 0 additions & 3 deletions Sources/MockoloFramework/Models/MethodModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ final class MethodModel: Model {
let processed: Bool
let modelDescription: String?
let isStatic: Bool
let shouldOverride: Bool
let isAsync: Bool
let throwing: ThrowingKind
let funcsWithArgsHistory: [String]
Expand Down Expand Up @@ -153,7 +152,6 @@ final class MethodModel: Model {
init(name: String,
typeName: String,
kind: MethodKind,
encloserType: FindTargetDeclType,
acl: String,
genericTypeParams: [ParamModel],
genericWhereClause: String?,
Expand All @@ -175,7 +173,6 @@ final class MethodModel: Model {
self.length = length
self.kind = kind
self.isStatic = isStatic
self.shouldOverride = encloserType == .classType
self.params = params
self.genericTypeParams = genericTypeParams
self.genericWhereClause = genericWhereClause
Expand Down
6 changes: 1 addition & 5 deletions Sources/MockoloFramework/Models/VariableModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ final class VariableModel: Model {
let offset: Int64
let accessLevel: String
let attributes: [String]?
let encloserType: FindTargetDeclType
/// Indicates whether this model can be used as a parameter to an initializer
let canBeInitParam: Bool
let processed: Bool
let isStatic: Bool
let shouldOverride: Bool
let storageKind: MockStorageKind
let rxTypes: [String: String]?
let customModifiers: [String: Modifier]?
Expand Down Expand Up @@ -50,7 +48,6 @@ final class VariableModel: Model {
init(name: String,
type: SwiftType,
acl: String?,
encloserType: FindTargetDeclType,
isStatic: Bool,
storageKind: MockStorageKind,
canBeInitParam: Bool,
Expand All @@ -65,14 +62,12 @@ final class VariableModel: Model {
self.offset = offset
self.isStatic = isStatic
self.storageKind = storageKind
self.shouldOverride = encloserType == .classType
self.canBeInitParam = canBeInitParam
self.processed = processed
self.rxTypes = rxTypes
self.customModifiers = customModifiers
self.accessLevel = acl ?? ""
self.attributes = nil
self.encloserType = encloserType
self.modelDescription = modelDescription
self.combineType = combineType
}
Expand All @@ -84,6 +79,7 @@ final class VariableModel: Model {
guard let enclosingType = context.enclosingType else {
return nil
}
let shouldOverride = context.annotatedTypeKind == .class
if processed {
guard let modelDescription = modelDescription?.trimmingCharacters(in: .newlines), !modelDescription.isEmpty else {
return nil
Expand Down
8 changes: 2 additions & 6 deletions Sources/MockoloFramework/Parsers/SwiftSyntaxExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ extension MemberBlockItemSyntax {
if let varMember = self.decl.as(VariableDeclSyntax.self) {
if validateMember(varMember.modifiers, declType, processed: processed) {
let acl = memberAcl(varMember.modifiers, encloserAcl, declType)
if let item = varMember.models(with: acl, declType: declType, metadata: metadata, processed: processed).first {
if let item = varMember.models(with: acl, metadata: metadata, processed: processed).first {
return (item, varMember.attributes.trimmedDescription, false)
}
}
Expand Down Expand Up @@ -403,7 +403,7 @@ extension AttributeListSyntax {
}

extension VariableDeclSyntax {
func models(with acl: String, declType: FindTargetDeclType, metadata: AnnotationMetadata?, processed: Bool) -> [Model] {
func models(with acl: String, metadata: AnnotationMetadata?, processed: Bool) -> [Model] {
// Detect whether it's static
let isStatic = self.modifiers.isStatic

Expand Down Expand Up @@ -454,7 +454,6 @@ extension VariableDeclSyntax {
return VariableModel(name: name,
type: SwiftType(typeName),
acl: acl,
encloserType: declType,
isStatic: isStatic,
storageKind: storageKind,
canBeInitParam: potentialInitParam,
Expand All @@ -480,7 +479,6 @@ extension SubscriptDeclSyntax {
let subscriptModel = MethodModel(name: self.subscriptKeyword.text,
typeName: self.returnClause.type.description,
kind: .subscriptKind,
encloserType: declType,
acl: acl,
genericTypeParams: genericTypeParams,
genericWhereClause: genericWhereClause,
Expand Down Expand Up @@ -510,7 +508,6 @@ extension FunctionDeclSyntax {
let funcmodel = MethodModel(name: self.name.description,
typeName: self.signature.returnClause?.type.description ?? "",
kind: .funcKind,
encloserType: declType,
acl: acl,
genericTypeParams: genericTypeParams,
genericWhereClause: genericWhereClause,
Expand Down Expand Up @@ -551,7 +548,6 @@ extension InitializerDeclSyntax {
return MethodModel(name: "init",
typeName: "",
kind: .initKind(required: requiredInit, override: declType == .classType),
encloserType: declType,
acl: acl,
genericTypeParams: genericTypeParams,
genericWhereClause: genericWhereClause,
Expand Down

0 comments on commit 7f3bc87

Please sign in to comment.