Skip to content

Commit fe96b92

Browse files
committed
Merge pull request SwiftyJSON#467 from glennrfisher/master
Replace ++ with +=
2 parents 9858784 + 20ee3ed commit fe96b92

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

Source/SwiftyJSON.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@ public struct JSONGenerator : GeneratorType {
396396
switch self.type {
397397
case .Array:
398398
if let o = self.arrayGenerate?.next() {
399-
return (String(self.arrayIndex++), JSON(o))
399+
let i = self.arrayIndex
400+
self.arrayIndex += 1
401+
return (String(i), JSON(o))
400402
} else {
401403
return nil
402404
}

Tests/SequenceTypeTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class SequenceTypeTests: XCTestCase {
5656
XCTAssertEqual(sub, json[index])
5757
XCTAssertEqual(i, "\(index)")
5858
array.append(sub.number!)
59-
index++
59+
index += 1
6060
}
6161
XCTAssertEqual(index, 5)
6262
XCTAssertEqual(array, [1,2.0,3.3,123456789,987654321.123456789])
@@ -72,7 +72,7 @@ class SequenceTypeTests: XCTestCase {
7272
XCTAssertEqual(sub, json[index])
7373
XCTAssertEqual(i, "\(index)")
7474
array.append(sub.bool!)
75-
index++
75+
index += 1
7676
}
7777
XCTAssertEqual(index, 5)
7878
XCTAssertEqual(array, [true, false, false, true, true])
@@ -88,7 +88,7 @@ class SequenceTypeTests: XCTestCase {
8888
XCTAssertEqual(sub, json[index])
8989
XCTAssertEqual(i, "\(index)")
9090
array.append(sub.string!)
91-
index++
91+
index += 1
9292
}
9393
XCTAssertEqual(index, 3)
9494
XCTAssertEqual(array, ["aoo","bpp","zoo"])
@@ -104,7 +104,7 @@ class SequenceTypeTests: XCTestCase {
104104
XCTAssertEqual(sub, json[index])
105105
XCTAssertEqual(i, "\(index)")
106106
array.append(sub.object)
107-
index++
107+
index += 1
108108
}
109109
XCTAssertEqual(index, 4)
110110
XCTAssertEqual(array[0] as? String, "aoo")
@@ -121,7 +121,7 @@ class SequenceTypeTests: XCTestCase {
121121
XCTAssertEqual(sub, json[index])
122122
XCTAssertEqual(i, "\(index)")
123123
array.append(sub.object)
124-
index++
124+
index += 1
125125
}
126126
XCTAssertEqual(index, 3)
127127
XCTAssertEqual((array[0] as! [String : Int])["1"]!, 1)
@@ -140,7 +140,7 @@ class SequenceTypeTests: XCTestCase {
140140
for (key, sub) in json {
141141
XCTAssertEqual(sub, json[key])
142142
dictionary[key] = sub.number!
143-
index++
143+
index += 1
144144
}
145145

146146
XCTAssertEqual(index, 2)
@@ -157,7 +157,7 @@ class SequenceTypeTests: XCTestCase {
157157
for (key, sub) in json {
158158
XCTAssertEqual(sub, json[key])
159159
dictionary[key] = sub.bool!
160-
index++
160+
index += 1
161161
}
162162

163163
XCTAssertEqual(index, 5)
@@ -174,7 +174,7 @@ class SequenceTypeTests: XCTestCase {
174174
for (key, sub) in json {
175175
XCTAssertEqual(sub, json[key])
176176
dictionary[key] = sub.string!
177-
index++
177+
index += 1
178178
}
179179

180180
XCTAssertEqual(index, 3)
@@ -191,7 +191,7 @@ class SequenceTypeTests: XCTestCase {
191191
for (key, sub) in json {
192192
XCTAssertEqual(sub, json[key])
193193
dictionary[key] = sub.object
194-
index++
194+
index += 1
195195
}
196196

197197
XCTAssertEqual(index, 4)
@@ -210,7 +210,7 @@ class SequenceTypeTests: XCTestCase {
210210
for (key, sub) in json {
211211
XCTAssertEqual(sub, json[key])
212212
dictionary[key] = sub.object
213-
index++
213+
index += 1
214214
}
215215

216216
XCTAssertEqual(index, 3)

0 commit comments

Comments
 (0)