Skip to content

Commit

Permalink
Remove local shadow variable self.properties should be used for cla…
Browse files Browse the repository at this point in the history
…rity. (#202)
  • Loading branch information
bolsinga authored and rahul-malik committed May 15, 2019
1 parent a2d1022 commit a8e91d3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Sources/Core/ObjCModelRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ public struct ObjCModelRenderer: ObjCFileRenderer {
}

func renderRoots() -> [ObjCIR.Root] {
let properties: [(Parameter, SchemaObjectProperty)] = rootSchema.properties.map { $0 } // Convert [String:Schema] -> [(String, Schema)]

let protocols: [String: [ObjCIR.Method]] = [
"NSSecureCoding": [self.renderSupportsSecureCoding(), self.renderInitWithCoder(), self.renderEncodeWithCoder()],
"NSCopying": [ObjCIR.method("- (id)copyWithZone:(NSZone *)zone") { ["return self;"] }],
Expand All @@ -143,13 +141,13 @@ public struct ObjCModelRenderer: ObjCFileRenderer {
}
}

let enumRoots = self.properties.flatMap { (param, prop) -> [ObjCIR.Root] in
let enumRoots = properties.flatMap { (param, prop) -> [ObjCIR.Root] in
enumRoot(from: prop.schema, param: param)
}

// TODO: Synthesize oneOf ADT Classes and Class Extension
// TODO: (rmalik): Clean this up, too much copy / paste here to support oneOf cases
let adtRoots = self.properties.flatMap { (param, prop) -> [ObjCIR.Root] in
let adtRoots = properties.flatMap { (param, prop) -> [ObjCIR.Root] in
switch prop.schema {
case let .oneOf(types: possibleTypes):
let objProps = possibleTypes.map { SchemaObjectProperty(schema: $0, nullability: $0.isObjCPrimitiveType ? nil : .nullable) }
Expand Down

0 comments on commit a8e91d3

Please sign in to comment.