Skip to content

Commit 1c9e24f

Browse files
authored
Merge pull request #48 from SportlabsTechnology/swift5
Swift5
2 parents 86b49d7 + 9236fc1 commit 1c9e24f

File tree

18 files changed

+77
-90
lines changed

18 files changed

+77
-90
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2
1+
5.0

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
notifications:
22
slack: zewo:VjyVCCQvTOw9yrbzQysZezD1
33
language: generic
4+
env:
5+
global:
6+
- SWIFT_VERSION=5.0
47
matrix:
58
include:
69
- os: osx
710
env: JOB=SwiftPM_OSX
8-
osx_image: xcode10.1
11+
osx_image: xcode10.2
912
- os: linux
1013
env: JOB=SwiftPM_linux
1114
dist: trusty

Package.resolved

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:5.0
22
import PackageDescription
33

44
let package = Package(
@@ -9,7 +9,7 @@ let package = Package(
99
],
1010

1111
dependencies: [
12-
.package(url: "https://github.com/wickwirew/Runtime.git", from: "1.1.0"),
12+
.package(url: "https://github.com/wickwirew/Runtime.git", .upToNextMinor(from: "2.1.0")),
1313

1414
// ⏱ Promises and reactive-streams in Swift built for high-performance and scalability.
1515
.package(url: "https://github.com/vapor/core.git", from: "3.0.0"),

Sources/GraphQL/Error/GraphQLError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ extension GraphQLError : CustomStringConvertible {
9191
}
9292

9393
extension GraphQLError : Hashable {
94-
public var hashValue: Int {
95-
return message.hashValue
94+
public func hash(into hasher: inout Hasher) {
95+
hasher.combine(message)
9696
}
9797

9898
public static func == (lhs: GraphQLError, rhs: GraphQLError) -> Bool {

Sources/GraphQL/Language/AST.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ public final class OperationDefinition {
337337
}
338338

339339
extension OperationDefinition : Hashable {
340-
public var hashValue: Int {
341-
return ObjectIdentifier(self).hashValue
340+
public func hash(into hasher: inout Hasher) {
341+
hasher.combine(ObjectIdentifier(self))
342342
}
343343

344344
public static func == (lhs: OperationDefinition, rhs: OperationDefinition) -> Bool {
@@ -450,8 +450,8 @@ public final class SelectionSet {
450450
}
451451

452452
extension SelectionSet : Hashable {
453-
public var hashValue: Int {
454-
return ObjectIdentifier(self).hashValue
453+
public func hash(into hasher: inout Hasher) {
454+
hasher.combine(ObjectIdentifier(self))
455455
}
456456

457457
public static func == (lhs: SelectionSet, rhs: SelectionSet) -> Bool {
@@ -709,8 +709,8 @@ public final class FragmentDefinition {
709709
}
710710

711711
extension FragmentDefinition : Hashable {
712-
public var hashValue: Int {
713-
return ObjectIdentifier(self).hashValue
712+
public func hash(into hasher: inout Hasher) {
713+
hasher.combine(ObjectIdentifier(self))
714714
}
715715

716716
public static func == (lhs: FragmentDefinition, rhs: FragmentDefinition) -> Bool {

Sources/GraphQL/Map/Map.swift

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -597,38 +597,22 @@ public func == (lhs: Map, rhs: Map) -> Bool {
597597
// MARK: Hashable
598598

599599
extension Map : Hashable {
600-
public var hashValue: Int {
600+
public func hash(into hasher: inout Hasher) {
601601
switch self {
602602
case .null:
603-
return 0
603+
hasher.combine(0)
604604
case .bool(let bool):
605-
return bool.hashValue
605+
hasher.combine(bool)
606606
case .double(let double):
607-
return double.hashValue
607+
hasher.combine(double)
608608
case .int(let int):
609-
return int.hashValue
609+
hasher.combine(int)
610610
case .string(let string):
611-
return string.hashValue
611+
hasher.combine(string)
612612
case .array(let array):
613-
var hash = 5381
614-
615-
for item in array {
616-
hash = ((hash << 5) &+ hash) &+ item.hashValue
617-
}
618-
619-
return hash
613+
hasher.combine(array)
620614
case .dictionary(let dictionary):
621-
var hash = 5381
622-
var keyHash = 5381
623-
var valueHash = 5381
624-
625-
for (key, value) in dictionary {
626-
keyHash = ((keyHash << 5) &+ keyHash) &+ key.hashValue
627-
valueHash = ((valueHash << 5) &+ valueHash) &+ value.hashValue
628-
hash = ((hash << 5) &+ hash) &+ (keyHash ^ valueHash)
629-
}
630-
631-
return hash
615+
hasher.combine(dictionary)
632616
}
633617
}
634618
}

0 commit comments

Comments
 (0)