Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove local shadow variable #202

Merged
merged 2 commits into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
bolsinga marked this conversation as resolved.
Show resolved Hide resolved
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