Skip to content

Commit b360cf8

Browse files
[NFC] rename TokenConsumtionHandle.missing to .tokenIsMissing
This clarifies what is missing at the use site. Also according the the API design guidelines: > **Uses of Boolean methods and properties should read as assertions about the receiver** when the use is nonmutating, e.g. `x.isEmpty`, `line1.intersects(line2)`.
1 parent fbd615b commit b360cf8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Sources/SwiftParser/Declarations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ extension Parser {
16581658

16591659
/// Parse an accessor.
16601660
mutating func parseAccessorDecl() -> RawAccessorDeclSyntax {
1661-
let forcedHandle = TokenConsumptionHandle(spec: .keyword(.get), missing: true)
1661+
let forcedHandle = TokenConsumptionHandle(spec: .keyword(.get), tokenIsMissing: true)
16621662
let introducer = parseAccessorIntroducer(forcedKind: (.get, forcedHandle))!
16631663
return parseAccessorDecl(introducer: introducer)
16641664
}

Sources/SwiftParser/Recovery.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public struct RecoveryConsumptionHandle {
3434
static func missing(_ spec: TokenSpec) -> RecoveryConsumptionHandle {
3535
return RecoveryConsumptionHandle(
3636
unexpectedTokens: 0,
37-
tokenConsumptionHandle: TokenConsumptionHandle(spec: spec, missing: true)
37+
tokenConsumptionHandle: TokenConsumptionHandle(spec: spec, tokenIsMissing: true)
3838
)
3939
}
4040
}

Sources/SwiftParser/TokenConsumer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct TokenConsumptionHandle {
4444
var spec: TokenSpec
4545
/// If `true`, the token we should consume should be synthesized as a missing token
4646
/// and no tokens should be consumed.
47-
var missing: Bool = false
47+
var tokenIsMissing: Bool = false
4848
}
4949

5050
extension TokenConsumer {
@@ -106,7 +106,7 @@ extension TokenConsumer {
106106
/// Eat a token that we know we are currently positioned at, based on `at(anyIn:)`.
107107
@inline(__always)
108108
mutating func eat(_ handle: TokenConsumptionHandle) -> Token {
109-
if handle.missing {
109+
if handle.tokenIsMissing {
110110
return missingToken(handle.spec)
111111
} else {
112112
return eat(handle.spec)

0 commit comments

Comments
 (0)