Commit Graph

10 Commits

Author SHA1 Message Date
Ryan Mansfield
8dad181aeb Remove unused diagnostics. 2024-07-16 14:10:02 -04:00
Alex Hoppen
e26c76dbd4 [SourceKit] Migrate getNotableRegions to new NameMatcher in swift-syntax 2023-12-12 12:58:15 -08:00
Ben Barham
b9810fb0a3 [SourceKit] Return the original location for decls within generated code
Pass back the original location (ie. where the macro was expanded, not
the location that the generated code would be inserted) for cursor info
and indexing. Also mark any declarations/references within generated
source as implicit.

Resolves rdar://107209132.
2023-03-30 11:20:33 -07:00
Ben Barham
d2de8ed83c [SourceKit] Merge local refactoring implementations
Retrieving local rename ranges and the local rename refactoring both had
almost identical methods, except for the addition of retrieving the
outermost shadowed decl that was added a couple months back. Merge them.

Resolves rdar://106529370.
2023-03-13 15:36:47 -07:00
Hamish Knight
2cfd2bf27d Don't handle unclassified switch cases for now
Previously we would silently add these to the
success block. For now, let's leave them
unhandled.
2021-06-09 10:43:24 +01:00
Ben Barham
8569c8a51b [Refactoring] Avoid redeclarations or shadowing in async refactored code
When converting a call or function, rename declarations such that
redeclaration errors and shadowing are avoided. In some cases this will
be overly conservative, but since any renamed variable can be fixed with
edit all in scope, this is preferred over causing redeclaration errors
or possible shadowing.

Resolves rdar://73973517
2021-05-13 17:48:41 +10:00
Ben Barham
a9073b0922 [Refactoring] Add async refactorings
Adds three refactorings intended to help users migrate their existing
code to use the new async language features:
  1. Convert call to use async alternative
  2. Convert function to async
  3. Add async alternative function

A function is considered to have an async alternative if it has a void
return type and has a void returning closure as its last parameter. A
method to explicitly mark functions as having an async alternative may
be added to make this more accurate in the future (required for eg.
a warning about a call to the non-async version of a function in an
async context).

(1) converts a call to use the new `await` async language syntax. If the
async alternative throws, it will also add `try`. The closure itself is
hoisted out of the call, see the comments on
`AsyncConversionStringBuilder` for specifics.

(2) converts a whole function to `async`, using (1) to convert any calls
in the function to their async alternatives. (3) is similar to (2), but
instead *adds* a function and replaces calls to its
completion/handler/callback closure parameter with `return` or `throws`.

Resolves rdar://68254700
2021-02-03 15:54:46 +10:00
Owen Voorhees
fdb6eabb0a [Diagnostics] Move macros used in diagnostic definitions to their own header
These were duplicated in 11 different files, and as they've gotten more
complex a few inconsistencies have snuck in. Sharing them should make future
changes easier and less bug-prone.
2020-04-14 18:10:30 -07:00
Owen Voorhees
f37c1dbaea [Gardening] Remove unused diagnostic definitions 2019-11-19 19:44:37 -08:00
Argyrios Kyrtzidis
60a91bb736 [refactoring] Upstreaming the implementation for Swift local refactoring (#11568)
[refactoring] Upstreaming the implementation for Swift local refactoring
2017-08-22 16:50:16 -07:00