mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implement SE-0001: Allow (most) keywords as argument labels.
Allow all keywords except for parameter introducers (var/let/inout) to be argument labels when declaring or calling a function/initializer/subscript, e.g., this func touchesMatching(phase: NSTouchPhase, `in` view: NSView?) -> Set<NSTouch> can now be expressed as func touchesMatching(phase: NSTouchPhase, in view: NSView?) -> Set<NSTouch> and the call goes from event.touchesMatching(phase, `in`: view) to event.touchesMatching(phase, in: view) Fixes [SR-344](https://bugs.swift.org/browse/SR-344) / rdar://problem/22415674.
This commit is contained in:
@@ -27,6 +27,13 @@
|
||||
using namespace swift;
|
||||
using namespace camel_case;
|
||||
|
||||
bool swift::canBeArgumentLabel(StringRef identifier) {
|
||||
if (identifier == "var" || identifier == "let" || identifier == "inout")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PrepositionKind swift::getPrepositionKind(StringRef word) {
|
||||
#define DIRECTIONAL_PREPOSITION(Word) \
|
||||
if (word.equals_lower(#Word)) \
|
||||
|
||||
Reference in New Issue
Block a user