Commit Graph

13 Commits

Author SHA1 Message Date
Doug Gregor
49aa0e966f Ensure that SourceFiles always have a backing buffer in the SourceManager
The "buffer ID" in a SourceFile, which is used to find the source file's
contents in the SourceManager, has always been optional. However, the
effectively every SourceFile actually does have a buffer ID, and the
vast majority of accesses to this information dereference the optional
without checking.

Update the handful of call sites that provided `nullopt` as the buffer
ID to provide a proper buffer instead. These were mostly unit tests
and testing programs, with a few places that passed a never-empty
optional through to the SourceFile constructor.

Then, remove optionality from the representation and accessors. It is
now the case that every SourceFile has a buffer ID, simplying a bunch
of code.
2024-09-16 21:46:42 -07:00
Slava Pestov
b601c294ac AST: Replace remaining uses of Type::transform() with transformRec() 2024-08-12 16:05:43 -04:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Hamish Knight
f4b928fd0a Remove FindLocalVal
Replace with an ASTScope lookup. This also lets
us simplify UsableFilteringDeclConsumer, and fixes
a couple of completion bugs.
2024-02-07 23:02:37 +00:00
Alex Hoppen
e26c76dbd4 [SourceKit] Migrate getNotableRegions to new NameMatcher in swift-syntax 2023-12-12 12:58:15 -08:00
Alex Hoppen
e538a5ed61 [SourceKit] Merge RenameLoc and RenameLocation
It’s easier to understand the code if we don’t have these two nearly, but not quite, identical types.
2023-12-06 14:33:14 -08:00
Alex Hoppen
ec267e2c08 [SourceKit] Hide RenameRangeDetailCollector as an implementation detail
The usage becomes a lot clearer if there’s just a top-level function that returns the details for the syntactic rename ranges.
2023-11-16 16:05:08 -08:00
Alex Hoppen
a0313e3005 [SourceKit] Merge Renamer and RenameRangeDetailCollector
With `TextReplacementsRenamer` gone, `RenameRangeDetailCollector` was the only remaining subclass of `Renamer`.
2023-11-16 16:05:08 -08:00
Alex Hoppen
ba06b5c075 [SourceKit] Replace UnresolvedLoc by SourceLoc
`UnresolvedLoc` was just a wrapper around `SourceLoc` and isn’t needed anymore.
2023-11-16 16:05:08 -08:00
Alex Hoppen
b3ab9bffd5 [SourceKit] Remove UnresolvedLoc.ResolveArgLocs
AFAICT we can just infer whether to resolve arguments based on the presence of arguments. We don’t need the information to be passed in.
2023-11-16 16:05:07 -08:00
Alex Hoppen
d9eef8c229 [SourceKit] Remove IsNonProtocolType parameter from rename locations
The parameter was never checked anywhere.
2023-11-16 16:05:07 -08:00
Alex Hoppen
d095d0a186 [SourceKit] Remove newName from RenameLoc
We should (and do) have one new name for the entire rename operation, not a separate new name for different positions at which the renamed symbol occurs.
2023-11-16 16:05:07 -08:00
Alex Hoppen
98f40197a6 [Refactoring] Move ExtractFunction to its own file 2023-09-11 16:31:09 -07:00