Commit Graph

163 Commits

Author SHA1 Message Date
Slava Pestov
03f1e13a50 IDE: Index references from keypaths 2018-07-05 23:33:59 -07:00
Rintaro Ishizaki
1fa04208e0 [IDE] Fix visiting DeferStmt
* Call balanced walkToStmtPost() for DeferStmt.
* In walkToStmtPre(), return DeferStmt itself instead of the body.

rdar://problem/39948168
2018-05-08 16:32:52 +09:00
Nathan Hawes
8fab22f124 [IDE] Fix imbalanced walkToDeclPre/Post calls in SemaAnotator for IfConfigDecls.
Resolves rdar://problem/39011293.
2018-03-30 13:03:49 -07: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
Ben Langmuir
4d9c9f6098 Move SourceEntityWalker into libAST NFC
It fits right in among our other AST walkers and lets us use it lower in
the stack than libIDE.
2016-04-01 14:14:06 -07:00
Xi Ge
701277e751 Allow SourceEntityWalker to visit operator decls, so that they can get indented properly. rdar://25246628 2016-03-19 14:47:58 -07:00
Ben Langmuir
9418b32b2a [SourceKit] Don't forget to check for nullptr
After 7400d484 we tried to walk into enum elements, but forgot to check
for missing types (which caused an assertion in getType) or element
decls (which caused an assertion or crash inside passReference).

rdar://problem/24634223
2016-02-18 14:08:44 -08:00
John Holdsworth
7400d48426 Fixes missing Xcode "Quick Help" for enum values as switch case patterns 2016-02-05 11:07:27 +00:00
Doug Gregor
8336419844 Include completion source location information compound DeclNames.
When one spells a compound declaration name in the source (e.g.,
insertSubview(_:aboveSubview:), keep track of the locations of the
base name, parentheses, and argument labels.
2016-01-25 14:13:13 -08:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
36d7072013 Remove immediately adjacent repeated words ("the the", "for for", "an an", etc.). 2015-12-21 22:16:04 +01:00
Xi Ge
5ca83d97a5 [InterfacePrint] Enhance ASTPrinter to support type-specific interface printing.
When users try to print the interface of a specific type (most often through cursor
infor query of SourceKit), we should simplify the original decls by replacing
archetypes with instantiated types, hiding extension details, and omitting
unfulfilled extension requirements. So the users can get the straight-to-the-point
"type interface". This commit builds the testing infrastructure for this feature,
and implements the first trick that wraps extension contents into the interface body.

This commit also moves some generic testing support from SourceKit to Swift.

Swift SVN r32630
2015-10-12 19:14:58 +00:00
Doug Gregor
226fa1543b Eliminate the Type from ComponentIdentTypeRepr.
With this change, TypeReprs no longer contain fully-resolved types for
any parsed code. Rather, they contain unresolved identifiers or the
declarations to which the identifiers have resolved.

As a minor space optimization, collapse the unbound (Identifier)
representation and the bound (ValueDecl *) representation into a
single pointer union.

Swift SVN r32434
2015-10-04 06:18:27 +00:00
Argyrios Kyrtzidis
012f6cb083 [IDE] Make sure to process the body of a defer statement properly.
Fixes IDE features (except code-completion) not working inside 'defer'.
rdar://22849414.

Swift SVN r32254
2015-09-26 00:50:39 +00:00
Doug Gregor
7a3f05a07a Reduce dependency on IdentTypeRepr::getBoundType().
Having bound types in TypeReprs causes trouble in several places
(mostly involving type-checking of generics), and doesn't really fit
with TypeReprs being a mostly syntactic construct. Eliminate some code
paths using getBoundType(), and make the others do the same thing for
getBoundDecl() and getBoundType(). As part of the latter, provide
TypeBase::getDirectlyReferencedTypeDecl() to more easily map from type
to the named declaration.

Swift SVN r32018
2015-09-16 23:25:19 +00:00
Denis Vnukov
19f761d526 Adding a separate method for visiting subscript references in SourceEntityWalker.
When SourceEntityWalker visits a subscript reference it sometimes needed to visit
both open and close brackets. It used to be implemented as two calls to a regular
visitDeclReference which confused the clients expecting one call per a reference, 
for example indexing was recording two references to a subscript.

We add a separate visitSubscriptReference to resolve this problem.



Swift SVN r31494
2015-08-26 16:33:15 +00:00
Denis Vnukov
9ea05141b7 Reverted: Allowing SourceEntityWalker to skip visiting subscript end location
Swift SVN r31456
2015-08-25 22:04:19 +00:00
Denis Vnukov
fa860f05cc Allowing SourceEntityWalker to skip visiting subscript end location
Swift SVN r31451
2015-08-25 20:38:55 +00:00
Argyrios Kyrtzidis
84e27fa26d [IDE] Properly annotate subscript brackets as references to subscript decls and enable jump-to-definition for them.
rdar://22099838

Swift SVN r30910
2015-08-01 05:36:13 +00:00
Xi Ge
57489ceb0f [SyntaxHighlighting] Give ASTWalker the option to walk into generic params of function decls.
Therefore, generic params can also benefit from syntax highlighting and semantic annotation
in SourceKit. rdar://20529255

Swift SVN r30220
2015-07-15 18:28:09 +00:00
Xi Ge
fedf76577b [ASTWalker] Allow client to specify whether SourceEntityWalker should walk into inactive regions.
Swift SVN r30003
2015-07-09 00:36:44 +00:00
Ben Langmuir
c5fbbc0d38 [SourceEntityWalker] Pass module DeclRef through visitModuleReference
This returns to the behaviour we had before ModuleDecl came about.  It
fixes an assertion in SourceKit concerning the kinds of decls we will
visit in visitDeclReference. As the comments indicate, we need this
special case until Swift supports first class submodules.

Swift SVN r28934
2015-05-22 21:17:09 +00:00
John McCall
155507d722 Teach ASTWalker to walk some more implicit expressions and
declarations generated by the type-checker.

Unfortunately, it's not possible to directly check this
because the verifier is itself based on ASTWalker.  But I'm
going to add an assertion to SILGen in a follow-up that
assumes that TypeCheckError has visited every ApplyExpr,
and since SILGen already walks most of the AST with its
own custom walker, that will check this well enough.

Swift SVN r28732
2015-05-19 00:54:27 +00:00
Doug Gregor
340e4d8f8a Simplify parsing and representation of extension declarations.
Now that we don't have generic parameter lists at arbitrary positions
within the extended type of an extension declaration, simplify the
representation of the extended type down to a TypeLoc along with a
(compiler-synthesized) generic parameter list.

On the parsing side, just parse a type for the extended type, rather
than having a special grammar. We still reject anything that is not a
nominal type (of course), but it's simpler just to call it a type.

As a drive-by, fix the crasher when extending a type with module
qualification, rdar://problem/20900870.

Swift SVN r28469
2015-05-12 16:26:13 +00:00
Doug Gregor
97136fa1c8 Remove the module representation from ComponentIdentTypeRepr.
It wasn't used anymore; NFC.

Swift SVN r28294
2015-05-07 22:03:46 +00:00
Doug Gregor
edbb75eef8 Eliminate the 'Module' variant from UnqualifiedLookupResult.
Make unqualified lookup always provide a declaration for the things it
finds, rather than providing either a module or a declaration. Unify
various code paths in our type checker now that module declarations
come in with the other declarations.

Swift SVN r28286
2015-05-07 21:10:55 +00:00
Argyrios Kyrtzidis
944e20949a [AST/IDE] Use TypeReprs to keep track of the type components in an ExtensionDecl.
This allows preserving type info and proper annotation of the extension's type components.

Swift SVN r25309
2015-02-16 08:36:16 +00:00
Denis Vnukov
844fe7dd77 Fix for rdar://19614869, Fuzzing Swift: AnnotAndDiagASTConsumer crashes in SemaAnnotator::walkToDeclPost(...): Assertion failed: "lazy var not implicitly computed"
Minor: modified assertion to handle invalid getters.



Swift SVN r24896
2015-02-02 19:09:51 +00:00
Argyrios Kyrtzidis
d039fb6369 [AST] Move ide::findUnderlyingClangModule() to Module::findUnderlyingClangModule() so that the ASTPrinter can use it.
Swift SVN r23691
2014-12-04 20:17:03 +00:00
Argyrios Kyrtzidis
1552772a15 [AST] Move ModuleEntity from libIDE to libAST so that the ASTPrinter can use it.
Swift SVN r23680
2014-12-04 05:52:16 +00:00
Denis Vnukov
8b288019f7 Coding style corrections #2
Swift SVN r23040
2014-10-31 22:16:13 +00:00
Denis Vnukov
eb72d7fc69 Coding style corrections
Swift SVN r23039
2014-10-31 22:01:07 +00:00
Denis Vnukov
995f365bdb Part of the fix for rdar://problem/18677108 (tests and more changes go to SourceKit). The swift’s part handles the cases when an implicit accessor was created, but its body is not synthesized; e.g. in case the owning PatternBindingDecl is invalid.
Swift SVN r23037
2014-10-31 21:41:01 +00:00
Sonny Falk
372ea11adc [IDE] Fix a crash trying to get the extended type of an ExtensionDecl with an un-typechecked AST.
Regression test on SourceKit side.

This addresses <rdar://problem/17999105>.

Swift SVN r21161
2014-08-13 01:19:22 +00:00
Sonny Falk
27be763ec6 [IDE] Fix a crash trying to walk the getter of a lazy property with an un-typechecked AST.
The getter for a lazy property may not exist yet, since it's synthesized by type checking.

This addresses <rdar://problem/17879459>.

Swift SVN r20985
2014-08-03 23:06:11 +00:00
Argyrios Kyrtzidis
a526dfcfb2 [IDE] Make sure to match-up the SEWalker.walkToDeclPost() calls with the SEWalker.walkToDeclPre() ones.
Swift SVN r20864
2014-08-01 00:20:34 +00:00
Doug Gregor
a0bc9274db Change parsing and representation of extensions to accommodate generic parameters.
The eventual goal for extensions of generic types is to require them
to specify their generic parameters, e.g.,

  extension Array<T> { ... }

rather than today's

  extension Array { ... }

Start parsing (optional) generic parameters here, and update the
representation of ExtensionDecl to accomodate this new grammar
production. Aside from the parser changes, there's no intended
functionality change here.

Swift SVN r20682
2014-07-29 19:17:00 +00:00
Argyrios Kyrtzidis
3175251bb1 [IDE] Handle annotation of clang submodule imports properly.
rdar://17780613

Swift SVN r20595
2014-07-26 20:58:19 +00:00
Ben Langmuir
2113e3a592 Walk through the initializer for a lazy property in SourceEntityWalker
@lazy foo: Int = {
  // Required for syntax highlighting and quick help here.
}()

Swift SVN r20078
2014-07-17 06:43:02 +00:00
Argyrios Kyrtzidis
1784315096 [AST/IDE] Keep track of semantic info of imports (resolved module and decls) and report module/decl references via
the SourceEntityWalker.

Swift SVN r17689
2014-05-08 07:10:06 +00:00
Argyrios Kyrtzidis
ccc23b60b0 [IDE] Report module references in type contexts.
Swift SVN r17688
2014-05-08 07:10:05 +00:00
Argyrios Kyrtzidis
17c3bae3cd [IDE] Enhance SourceEntityWalker to provide callbacks for the keyword arguments of
a call expression.

Swift SVN r17607
2014-05-07 06:10:03 +00:00
Argyrios Kyrtzidis
ab2e58ec6e [IDE] Fix crash with semantic annotation for an incomplete enum.
rdar://16102613

Swift SVN r15227
2014-03-19 07:02:21 +00:00
Dmitri Hrybenko
ab9dcd39c4 Source annotation: fix a crash on var decls with propagated types
rdar://16194527


Swift SVN r14868
2014-03-10 15:09:04 +00:00
Argyrios Kyrtzidis
55c02e0cf0 [IDE] Handle observing accessors for syntax and semantic annotations.
Swift SVN r13295
2014-02-01 06:22:21 +00:00
Argyrios Kyrtzidis
dc258df962 [IDE] Make sure the constructor reference in a [super/self].init is reported by the SourceEntityWalker.
Swift SVN r12957
2014-01-26 05:13:50 +00:00
Argyrios Kyrtzidis
84e20a0620 [AST] Break down IdentTypeRepr to different subtypes.
This makes memory allocation for it more efficient and it's more convenient to handle.

Swift SVN r12541
2014-01-18 20:19:09 +00:00
Jordan Rose
417b5d3982 Merge TranslationUnit into Module, and eliminate the term "translation unit".
This completes the FileUnit refactoring. A module consists of multiple
FileUnits, which provide decls from various file-like sources. I say
"file-like" because the Builtin module is implemented with a single
BuiltinUnit, and imported Clang modules are just a single FileUnit source
within a module.

Most modules, therefore, contain a single file unit; only the main module
will contain multiple source files (and eventually partial AST files).

The term "translation unit" has been scrubbed from the project. To refer
to the context of declarations outside of any other declarations, use
"top-level" or "module scope". To refer to a .swift file or its DeclContext,
use "source file". To refer to a single unit of compilation, use "module",
since the model is that an entire module will be compiled with a single
driver call. (It will still be possible to compile a single source file
through the direct-to-frontend interface, but only in the context of the
whole module.)

Swift SVN r10837
2013-12-05 01:51:15 +00:00