File tree Expand file tree Collapse file tree 3 files changed +10
-22
lines changed Expand file tree Collapse file tree 3 files changed +10
-22
lines changed Original file line number Diff line number Diff line change @@ -269,13 +269,10 @@ class alignas(8) PoundAvailableInfo final :
269
269
const VersionRange &getAvailableRange () const { return AvailableRange; }
270
270
void setAvailableRange (const VersionRange &Range) { AvailableRange = Range; }
271
271
272
- void getPlatformKeywordRanges (SmallVectorImpl<CharSourceRange>
273
- &PlatformRanges);
272
+ void getPlatformKeywordLocs (SmallVectorImpl<SourceLoc> &PlatformLocs);
274
273
};
275
274
276
-
277
275
278
-
279
276
// / This represents an entry in an "if" or "while" condition. Pattern bindings
280
277
// / can bind any number of names in the pattern binding decl, and may have an
281
278
// / associated where clause. When "if let" is involved, an arbitrary number of
Original file line number Diff line number Diff line change @@ -284,24 +284,14 @@ SourceLoc PoundAvailableInfo::getEndLoc() const {
284
284
}
285
285
286
286
void PoundAvailableInfo::
287
- getPlatformKeywordRanges (SmallVectorImpl<CharSourceRange > &PlatformRanges ) {
287
+ getPlatformKeywordLocs (SmallVectorImpl<SourceLoc > &PlatformLocs ) {
288
288
for (unsigned i = 0 ; i < NumQueries; i++) {
289
289
auto *VersionSpec =
290
290
dyn_cast<VersionConstraintAvailabilitySpec>(getQueries ()[i]);
291
291
if (!VersionSpec)
292
292
continue ;
293
293
294
- auto Loc = VersionSpec->getPlatformLoc ();
295
- auto Platform = VersionSpec->getPlatform ();
296
- switch (Platform) {
297
- case PlatformKind::none:
298
- break ;
299
- #define AVAILABILITY_PLATFORM (X, PrettyName ) \
300
- case PlatformKind::X: \
301
- PlatformRanges.push_back (CharSourceRange (Loc, strlen (#X))); \
302
- break ;
303
- #include " swift/AST/PlatformKinds.def"
304
- }
294
+ PlatformLocs.push_back (VersionSpec->getPlatformLoc ());
305
295
}
306
296
}
307
297
Original file line number Diff line number Diff line change @@ -549,12 +549,13 @@ void ModelASTWalker::handleStmtCondition(StmtCondition cond) {
549
549
for (const auto &elt : cond) {
550
550
if (elt.getKind () != StmtConditionElement::CK_Availability) continue ;
551
551
552
- SmallVector<CharSourceRange, 5 > PlatformRanges;
553
- elt.getAvailability ()->getPlatformKeywordRanges (PlatformRanges);
554
- std::for_each (PlatformRanges.begin (), PlatformRanges.end (),
555
- [&](CharSourceRange &Range) {
556
- passNonTokenNode ({SyntaxNodeKind::Keyword, Range});
557
- });
552
+ SmallVector<SourceLoc, 5 > PlatformLocs;
553
+ elt.getAvailability ()->getPlatformKeywordLocs (PlatformLocs);
554
+ std::for_each (PlatformLocs.begin (), PlatformLocs.end (),
555
+ [&](SourceLoc loc) {
556
+ auto range = charSourceRangeFromSourceRange (SM, loc);
557
+ passNonTokenNode ({SyntaxNodeKind::Keyword, range});
558
+ });
558
559
}
559
560
}
560
561
You can’t perform that action at this time.
0 commit comments