Skip to content

Commit 787957f

Browse files
author
Pouya Yarandi
committed
Fix variable names with underscore
1 parent fcec7f2 commit 787957f

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

Sources/SwiftProtobuf/GetPathDecoder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,15 @@ struct GetPathDecoder<T: Message>: Decoder {
311311

312312
extension Message {
313313
mutating func `get`(path: String) throws -> Any? {
314-
let _path = path.components(separatedBy: ".")
315-
var decoder = try GetPathDecoder<Self>(path: _path)
314+
let components = path.components(separatedBy: ".")
315+
var decoder = try GetPathDecoder<Self>(path: components)
316316
try decodeMessage(decoder: &decoder)
317317
return decoder.value
318318
}
319319

320320
mutating func hasPath(path: String) -> Bool {
321-
let _path = path.components(separatedBy: ".")
322-
guard var decoder = try? GetPathDecoder<Self>(path: _path) else {
321+
let components = path.components(separatedBy: ".")
322+
guard var decoder = try? GetPathDecoder<Self>(path: components) else {
323323
return false
324324
}
325325
try? decodeMessage(decoder: &decoder)

Sources/SwiftProtobuf/Google_Protobuf_FieldMask+Extensions.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ extension Google_Protobuf_FieldMask {
262262
_ mask: Google_Protobuf_FieldMask
263263
) -> Google_Protobuf_FieldMask {
264264
var buffer: Set<String> = .init()
265-
var _paths: [String] = []
266-
let allPaths = paths + mask.paths
265+
var paths: [String] = []
266+
let allPaths = self.paths + mask.paths
267267
for path in allPaths where !buffer.contains(path) {
268268
buffer.insert(path)
269-
_paths.append(path)
269+
paths.append(path)
270270
}
271271
return .with { mask in
272-
mask.paths = _paths
272+
mask.paths = paths
273273
}
274274
}
275275

@@ -281,14 +281,14 @@ extension Google_Protobuf_FieldMask {
281281
_ mask: Google_Protobuf_FieldMask
282282
) -> Google_Protobuf_FieldMask {
283283
let set = mask.pathsSet
284-
var _paths: [String] = []
285-
var _buffer = Set<String>()
286-
for path in paths where set.contains(path) && !_buffer.contains(path) {
287-
_buffer.insert(path)
288-
_paths.append(path)
284+
var paths: [String] = []
285+
var buffer = Set<String>()
286+
for path in self.paths where set.contains(path) && !buffer.contains(path) {
287+
buffer.insert(path)
288+
paths.append(path)
289289
}
290290
return .with { mask in
291-
mask.paths = _paths
291+
mask.paths = paths
292292
}
293293
}
294294

@@ -301,14 +301,14 @@ extension Google_Protobuf_FieldMask {
301301
_ mask: Google_Protobuf_FieldMask
302302
) -> Google_Protobuf_FieldMask {
303303
let set = mask.pathsSet
304-
var _paths: [String] = []
305-
var _buffer = Set<String>()
306-
for path in paths where !set.contains(path) && !_buffer.contains(path) {
307-
_buffer.insert(path)
308-
_paths.append(path)
304+
var paths: [String] = []
305+
var buffer = Set<String>()
306+
for path in self.paths where !set.contains(path) && !buffer.contains(path) {
307+
buffer.insert(path)
308+
paths.append(path)
309309
}
310310
return .with { mask in
311-
mask.paths = _paths
311+
mask.paths = paths
312312
}
313313
}
314314

@@ -320,8 +320,8 @@ extension Google_Protobuf_FieldMask {
320320
/// - Parameter path: Path to be checked.
321321
/// - Returns: Boolean determines is path covered.
322322
public func contains(_ path: String) -> Bool {
323-
for _path in paths {
324-
if path.hasPrefix("\(_path).") || _path == path {
323+
for fieldMaskPath in paths {
324+
if path.hasPrefix("\(fieldMaskPath).") || fieldMaskPath == path {
325325
return true
326326
}
327327
}

Sources/SwiftProtobuf/SetPathDecoder.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,33 @@ struct SetPathDecoder<T: Message>: Decoder {
7373
}
7474

7575
private func setValue<V>(_ value: inout V) throws {
76-
guard let __value = self.value as? V else {
76+
guard let castedValue = self.value as? V else {
7777
throw PathDecodingError.typeMismatch
7878
}
79-
value = __value
79+
value = castedValue
8080
}
8181

8282
private func setRepeatedValue<V>(_ value: inout [V]) throws {
83-
guard let __value = self.value as? [V] else {
83+
guard let castedValue = self.value as? [V] else {
8484
throw PathDecodingError.typeMismatch
8585
}
8686
if replaceRepeatedFields {
87-
value = __value
87+
value = castedValue
8888
} else {
89-
value.append(contentsOf: __value)
89+
value.append(contentsOf: castedValue)
9090
}
9191
}
9292

9393
private func setMapValue<K, V>(
9494
_ value: inout Dictionary<K, V>
9595
) throws {
96-
guard let __value = self.value as? Dictionary<K, V> else {
96+
guard let castedValue = self.value as? Dictionary<K, V> else {
9797
throw PathDecodingError.typeMismatch
9898
}
9999
if replaceRepeatedFields {
100-
value = __value
100+
value = castedValue
101101
} else {
102-
value.merge(__value) { _, new in
102+
value.merge(castedValue) { _, new in
103103
new
104104
}
105105
}

0 commit comments

Comments
 (0)