Slava Pestov
5213f80e7e
IDE: Remove uses of AbstractFunctionDecl::getParameterLists()
2018-07-22 20:56:56 -07:00
Rintaro Ishizaki
dc76149150
[IDE] Use getStartLoc() for matching pattern ranges
...
For Example `getLoc()` for `foo as Ty`(`IsPattern`) is at 'as'. We
should try to resolve this at position of 'foo'.
2018-05-11 15:34:42 +09:00
Robert Widmann
03580d2fe5
Add a parameter list to EnumElementDecl
...
This models, but does not plumb through, default arguments.
2018-03-28 00:05:56 -04:00
Nathan Hawes
80e10b188b
[CursorInfo] Fix crash on instance variables used directly in if or for when declared in a generic context
...
For example:
class Foo<T> {
let test: Bool = false
let items: [Int] = []
func foo() {
if test {} // crashes on test
for i in items {} // crashes on items
}
}
We were picking up the incorrect containing type (Bool rather than Foo<T>).
Resolves rdar://problem/36871908.
2018-01-25 14:51:08 -08:00
Argyrios Kyrtzidis
14116f84a1
[sourcekitd] Fix cursor resolving when pointing inside string interpolations of return statements
...
rdar://36336648
2018-01-09 11:46:15 -08:00
Nathan Hawes
340d9089a0
[Refactoring] Local rename in lazy block failing
...
Some of the implicit decls generated for lazy vars have invalid source ranges.
For now, just always walk into implicit decls when looking for name locations.
Resolves rdar://problem/35255644.
2017-12-14 10:52:13 -08:00
Nathan Hawes
d769791414
[rename] Make sure we walk the base of the subscript expression before trying to resolve any reference on the '['
2017-12-01 19:35:43 -08:00
Nathan Hawes
c326ec46c7
[Refactoring] Fix subscript rename
...
Adds support for renaming subscripts with external names, e.g.
subscript(x y: Int), and introduces a noncollapsible parameter name range for
subscript parameters, since these shouldn't be collapsed with an argument label
of the same name as function parameter names are.
2017-11-28 19:45:29 -08:00
Nathan Hawes
c4e87f0861
[Refactoring] Fix local rename missing occurrences in string interpolations
...
NameMatcher checked if a StringLiteralExpr was a string segment in an
interpolated string by checking if the parent expression was an
InterpolatedStringLiteralExpr. That's only true pre-type-checking, and unlike
global rename, local rename uses the type-checked AST.
2017-11-17 20:16:59 -08:00
Slava Pestov
a70a1f0d36
IDE: Fix bug in SourceEntityWalker subscript handling
...
We weren't passing the lvalue access kind to the subscript.
This was causing a test to fail with the next patch.
2017-11-13 22:19:25 -08:00
Slava Pestov
0715eaeaed
AST: Move SourceEntityWalker to IDE
2017-11-13 22:10:41 -08:00
Alex Hoppen
746bfc6d59
[Refactoring] Add refactoring action to move type members to extension ( #12795 )
...
This implements SR-6297.
2017-11-09 11:08:34 -08:00
Rintaro Ishizaki
53e514518b
[IDE] Add SourceFile property to ResolvedCursorInfo
2017-10-16 00:24:30 -07:00
Kacper Harasim
8cd677eb1f
[Refactoring] SR-6051 Expansion of switch statement missing cases ( #12281 )
2017-10-13 09:37:58 -07:00
Kacper Harasim
c7b9307348
[Refactoring] CursorInfoResolver now properly handles cursor placement in OptionalTryExpr and ForceTryExpr, NFC ( #12123 )
2017-09-26 14:29:10 -07:00
Kacper Harasim
6fcb8308ff
[IDE] Refactoring: conversion from “force try” to error handled version ( #12063 )
...
* [IDE] Refactoring: conversion from “force try” do error handled version
* Removed unnecessary empty line
* Changed name of the refactor
* Review fixes
* Fixed recognizing try_! location by CursorResolver
* Review fixes
2017-09-24 09:05:32 -04:00
Saleem Abdulrasool
7bd2256120
runtime: clean up last of -Wqual-cast warnings
...
This fixes up the remaining cast qualifier warnings from GCC 6. Use
multiple casts to adjust the const qualification. Prefer C++ style
casts. NFC.
2017-09-22 14:14:13 -07:00
Xi Ge
5626c72718
Refactoring tool: Avoid re-tokenizing when collecting the available refactorings in a given source range. NFC ( #11857 )
2017-09-11 15:45:26 -07:00
Xi Ge
acfb511357
RangeInfo: Add several defensive null pointer checks. rdar://32047178 ( #11729 )
2017-09-01 13:47:32 -07:00
Xi Ge
7f29b362d6
SourceKitd: Rename SemaToken to ResolvedCursorInfo. NFC ( #11680 )
2017-08-29 15:34:15 -07: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
Xi Ge
a6b25eac8d
RangeInfo: Remove unused fields in resolver. NFC ( #11137 )
2017-07-24 11:31:54 -07:00
Xi Ge
7595ed353e
[RangeInfo] Address Argyrios' code review comments. NFC ( #11114 )
2017-07-21 18:10:52 -07:00
Xi Ge
ac348b597a
[RangeInfo] Using the underlying token array reference to represent the content of a range under selection. ( #11106 )
...
Comparing to CharSourceRange, token stream is a better way because we can preserve comment information at the start of the range.
Needed for rdar://33437855
2017-07-21 16:19:25 -07:00
Xi Ge
e1a4bf32dd
[SourceKit] When Cursor infor resolves to the start of an expression, we always get the outermost expression. ( #10738 )
...
The reason is that for clients, getting the offspring of an expression is
much easier that getting parents.
2017-06-30 17:57:36 -07:00
Alex Hoppen
949968a182
Adjust printing to take into account special DeclNames
...
Print DeclBaseNames using a new userFacingStr() method to prepare for
DeclBaseNames that are not backed by Identifiers
2017-06-24 11:39:09 +02:00
Xi Ge
1ea4d9ff98
CursorInfo: Teach SemaLocResolver to recognize the start of an expression, if the location cannot be further refined to other kind, e.g. a reference. rdar://32749670
2017-06-19 13:28:36 -07:00
Robert Widmann
abd5aa8e6d
Rename some X-Value-related entities
...
* Rename coerceToMaterializableValue to coerceToRValue
* Rename isLValueType to hasLValueType to better match the
intended semantics of the member.
2017-06-14 13:18:45 -07:00
Xi Ge
673d04f240
Range-info: when checking if a decl reference is contained in the selected range, consider only the start location. rdar://32415952 ( #10207 )
2017-06-12 13:52:28 -07:00
Xi Ge
04eb001c9d
RangeInfo: Avoid analyzing orphan kind if the given node list is empty; tentatively fixing rdar://32533734.
2017-06-09 15:44:08 -07:00
Alex Hoppen
73c524ca5e
[IDE] Preparations for removal of getName on ValueDecl
...
With the introduction of special decl names, `Identifier getName()` on
`ValueDecl` will be removed and pushed down to nominal declarations
whose name is guaranteed not to be special. Prepare for this by calling
to `DeclBaseName getBaseName()` instead where appropriate.
2017-05-28 19:13:24 -07:00
Xi Ge
d6b4c3e77b
RangeInfo: unbox switch statement to ensure all branches agree on return information. rdar://32289109 ( #9788 )
2017-05-19 14:36:56 -07:00
Xi Ge
83183abc38
RangeInfo: Add a new range info kind that describes part of a parent expression. rdar://32039874 ( #9707 )
2017-05-17 14:21:47 -07:00
Xi Ge
9c6e3bd398
RangeInfo: Use CharSourceRange to represent the selected range, NFC. rdar://32225277 ( #9660 )
2017-05-16 15:45:30 -07:00
Xi Ge
058d7f62e8
[migrator] Various quality improvement on type-hoist API migrations. rdar://32186526 ( #9600 )
2017-05-14 19:25:01 -07:00
Xi Ge
65b9043eb1
migrator: handle function hoist API changes and several its varieties. rdar://31234806 ( #9544 )
2017-05-12 21:34:06 -07:00
Xi Ge
166d388de0
RangeInfo: stuff a bit about whether the selected range exits. ( #9389 )
2017-05-08 13:28:32 -07:00
Xi Ge
38991ca83f
RangeInfo: unbox ifstmt to get the agreed-upon return type from selected statements. rdar://31691723 ( #9380 )
2017-05-07 19:08:47 -07:00
Xi Ge
a14953809a
[SourceKit] When cursor points to an external argument name in a function-like decl, we should return the information about the function-like decl instead of being empty. rdar://32018814 ( #9356 )
2017-05-05 17:12:34 -07:00
practicalswift
492f5cd35a
[gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
...
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.
The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).
See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names ) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
2017-05-05 09:45:53 +02:00
Xi Ge
57fa43c9af
[RangeInfo] Avoid analyzing implicit ASTNodes. rdar://31773556 ( #9210 )
2017-05-02 21:19:46 -07:00
Argyrios Kyrtzidis
40c89048ba
[index] Make sure that we index implicit constructors
...
These can be explicitely referenced so we should index their definitions as well
2017-04-29 19:14:03 -07:00
practicalswift
ab5aaeb359
Merge pull request #9001 from practicalswift/gardening-20170425
...
[gardening] Unused variables. Unused diagnostics. Namespace comments. Typos.
2017-04-26 09:28:24 +02:00
Xi Ge
7163a40ffb
[Migrator] Support framework API function renames. rdar://31766131 ( #9013 )
2017-04-25 15:50:40 -07:00
practicalswift
861f70e13d
[gardening] Use consistent spacing
2017-04-25 21:03:43 +02:00
Xi Ge
cbd62cb721
IDE: Expose a utility to collect argument label ranges from either tuple or paren exprs. ( #8982 )
2017-04-24 17:26:32 -07:00
practicalswift
7eb7d5b109
[gardening] Fix 100 typos.
2017-04-18 17:01:42 +02:00
practicalswift
40cf4d183d
[gardening] Use consistent spacing after if, for and while
2017-04-14 17:35:36 +02:00
practicalswift
5e255e07d7
[gardening] Remove redundant logic
2017-04-11 23:04:55 +02:00
Xi Ge
1827fb1436
RangeInfo: Report RValue type if a decl reference is of read-only LValue type. ( #8300 )
2017-03-23 15:52:54 -07:00