Skip to content

Commit

Permalink
fixed issues as best I could with current knowledge re: Xcode 7 beta …
Browse files Browse the repository at this point in the history
…6 language changes

Converted to Swift 2.0 for XCode 7.0 Beta 6. Compiles but does not pass tests.
  • Loading branch information
Emily Toop authored and stephencelis committed Aug 29, 2015
1 parent f895cea commit 7a944c3
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Source/Extensions/FTS4.swift
Expand Up @@ -101,12 +101,12 @@ public struct Tokenizer {
}

if !tokenchars.isEmpty {
let joined = "".join(tokenchars.map { String($0) })
let joined = tokenchars.map { String($0) }.joinWithSeparator("")
arguments.append("tokenchars=\(joined)".quote())
}

if !separators.isEmpty {
let joined = "".join(separators.map { String($0) })
let joined = separators.map { String($0) }.joinWithSeparator("")
arguments.append("separators=\(joined)".quote())
}

Expand All @@ -133,7 +133,7 @@ public struct Tokenizer {
extension Tokenizer : CustomStringConvertible {

public var description: String {
return " ".join([name] + arguments)
return ([name] + arguments).joinWithSeparator(" ")
}

}
Expand All @@ -146,7 +146,7 @@ extension Connection {
if let (token, range) = next(string) {
let view = string.utf8
offset.memory += string.substringToIndex(range.startIndex).utf8.count
length.memory = Int32(distance(range.startIndex.samePositionIn(view), range.endIndex.samePositionIn(view)))
length.memory = Int32(range.startIndex.samePositionIn(view).distanceTo(range.endIndex.samePositionIn(view)))
return token
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion Source/Extensions/R*Tree.swift
Expand Up @@ -28,7 +28,7 @@ extension Module {
var arguments: [Expressible] = [primaryKey]

for pair in pairs {
arguments.extend([pair.0, pair.1] as [Expressible])
arguments.appendContentsOf([pair.0, pair.1] as [Expressible])
}

return Module(name: "rtree", arguments: arguments)
Expand Down
10 changes: 5 additions & 5 deletions Source/Helpers.swift
Expand Up @@ -30,13 +30,13 @@ public func *(_: Expression<Binding>?, _: Expression<Binding>?) -> Expression<Vo

public protocol _OptionalType {

typealias Wrapped
typealias WrappedType

}

extension Optional : _OptionalType {

public typealias Wrapped = T
public typealias WrappedType = Wrapped

}

Expand Down Expand Up @@ -65,9 +65,9 @@ extension String {
for expressible in expressions {
let expression = expressible.expression
template.append(expression.template)
bindings.extend(expression.bindings)
bindings.appendContentsOf(expression.bindings)
}
return Expression<Void>(join(template), bindings)
return Expression<Void>(template.joinWithSeparator(self), bindings)
}

@warn_unused_result func infix<T>(lhs: Expressible, _ rhs: Expressible, wrap: Bool = true) -> Expression<T> {
Expand Down Expand Up @@ -112,7 +112,7 @@ extension String {
if let literal = literal {
if let literal = literal as? NSData {
let buf = UnsafeBufferPointer(start: UnsafePointer<UInt8>(literal.bytes), count: literal.length)
let hex = "".join(buf.map { String(format: "%02x", $0) })
let hex = buf.map { String(format: "%02x", $0) }.joinWithSeparator("")
return "x'\(hex)'"
}
if let literal = literal as? String { return literal.quote("'") }
Expand Down
6 changes: 3 additions & 3 deletions Source/Typed/AggregateFunctions.swift
Expand Up @@ -53,7 +53,7 @@ extension ExpressionType where UnderlyingType : Value {

}

extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Value {
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value {

/// Builds a copy of the expression prefixed with the `DISTINCT` keyword.
///
Expand Down Expand Up @@ -114,7 +114,7 @@ extension ExpressionType where UnderlyingType : protocol<Value, Comparable> {

}

extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : protocol<Value, Comparable> {
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : protocol<Value, Comparable> {

/// Builds a copy of the expression wrapped with the `max` aggregate
/// function.
Expand Down Expand Up @@ -187,7 +187,7 @@ extension ExpressionType where UnderlyingType : Value, UnderlyingType.Datatype :

}

extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Value, UnderlyingType.Wrapped.Datatype : Number {
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value, UnderlyingType.WrappedType.Datatype : Number {

/// Builds a copy of the expression wrapped with the `avg` aggregate
/// function.
Expand Down
6 changes: 3 additions & 3 deletions Source/Typed/CoreFunctions.swift
Expand Up @@ -37,7 +37,7 @@ extension ExpressionType where UnderlyingType : Number {

}

extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Number {
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Number {

/// Builds a copy of the expression wrapped with the `abs` function.
///
Expand Down Expand Up @@ -598,7 +598,7 @@ extension CollectionType where Generator.Element : Value, Index.Distance == Int
/// - Returns: A copy of the expression prepended with an `IN` check against
/// the collection.
@warn_unused_result public func contains(expression: Expression<Generator.Element>) -> Expression<Bool> {
let templates = ", ".join([String](count: count, repeatedValue: "?"))
let templates = [String](count: count, repeatedValue: "?").joinWithSeparator(", ")
return "IN".infix(expression, Expression<Void>("(\(templates))", map { $0.datatypeValue }))
}

Expand All @@ -614,7 +614,7 @@ extension CollectionType where Generator.Element : Value, Index.Distance == Int
/// - Returns: A copy of the expression prepended with an `IN` check against
/// the collection.
@warn_unused_result public func contains(expression: Expression<Generator.Element?>) -> Expression<Bool?> {
let templates = ", ".join([String](count: count, repeatedValue: "?"))
let templates = [String](count: count, repeatedValue: "?").joinWithSeparator(", ")
return "IN".infix(expression, Expression<Void>("(\(templates))", map { $0.datatypeValue }))
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Typed/Expression.swift
Expand Up @@ -108,13 +108,13 @@ extension ExpressionType where UnderlyingType : Value {

}

extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Value {
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value {

public static var null: Self {
return self.init(value: nil)
}

public init(value: UnderlyingType.Wrapped?) {
public init(value: UnderlyingType.WrappedType?) {
self.init("?", [value?.datatypeValue])
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Typed/Query.swift
Expand Up @@ -851,7 +851,7 @@ extension Connection {
column: for each in query.clauses.select.columns ?? [Expression<Void>(literal: "*")] {
var names = each.expression.template.characters.split { $0 == "." }.map(String.init)
let column = names.removeLast()
let namespace = ".".join(names)
let namespace = names.joinWithSeparator(".")

func expandGlob(namespace: Bool) -> QueryType -> Void {
return { query in
Expand Down
2 changes: 1 addition & 1 deletion Source/Typed/Schema.swift
Expand Up @@ -152,7 +152,7 @@ extension Table {
}

private func indexName(columns: [Expressible]) -> Expressible {
let string = " ".join(["index", clauses.from.name, "on"] + columns.map { $0.expression.template }).lowercaseString
let string = (["index", clauses.from.name, "on"] + columns.map { $0.expression.template }).joinWithSeparator(" ").lowercaseString

let index = string.characters.reduce("") { underscored, character in
guard character != "\"" else {
Expand Down

0 comments on commit 7a944c3

Please sign in to comment.