-
Notifications
You must be signed in to change notification settings - Fork 440
Parse attributes in #if
#1276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse attributes in #if
#1276
Conversation
@swift-ci Please test |
Sources/SwiftParser/Lookahead.swift
Outdated
@@ -207,42 +207,35 @@ extension Parser.Lookahead { | |||
return true | |||
} | |||
|
|||
/// Tries consuming a `#if` directive that only contains attributes. | |||
/// Returns `true` if that was successful and `false` if | |||
/// - we are not at a valid `#if` directive (e.g. `#elseif` is missing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// - we are not at a valid `#if` directive (e.g. `#elseif` is missing) | |
/// - we are not at a valid `#if` directive (e.g. `#endif` is missing) |
Sources/SwiftParser/Lookahead.swift
Outdated
var didSeeAnyAttributes = false | ||
var poundIfLoopProgress = LoopProgressCondition() | ||
repeat { | ||
self.consume(ifAny: [.poundIfKeyword, .poundElseKeyword, .poundEndifKeyword]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You meant poundElseifKeyword
?
self.consume(ifAny: [.poundIfKeyword, .poundElseKeyword, .poundEndifKeyword]) | |
assert(self.at(any: [.poundIfKeyword, .poundElseifKeyword, .poundElseKeyword])) | |
consumeAnyToken() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks
@@ -120,6 +120,13 @@ extension TokenConsumer { | |||
return false | |||
} | |||
} | |||
|
|||
mutating func atStartOfIfConfigOfAttributes() -> Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes. Thanks
Fixes swiftlang#1119 rdar://103048943
b3a2458
to
0381f9c
Compare
@swift-ci Please test |
Fixes #1119
rdar://103048943