Aleksey Kladov
cebeedc66f
Next gen IDs for functions
...
The current system with AstIds has two primaraly drawbacks:
* It is possible to manufacture IDs out of thin air.
For example, it's possible to create IDs for items which are not
considered in CrateDefMap due to cfg. Or it is possible to mixup
structs and unions, because they share ID space.
* Getting the ID of a parent requires a secondary index.
Instead, the plan is to pursue the more traditional approach, where
each items stores the id of the parent declaration. This makes
`FromSource` more awkward, but also more correct: now, to get from an
AST to HIR, we first do this recursively for the parent item, and the
just search the children of the parent for the matching def
2019-11-20 16:22:58 +03:00
Aleksey Kladov
51baaf298d
Rename with_ast -> with_value
2019-11-20 13:09:21 +03:00
Aleksey Kladov
36e3fc9d54
Rename Source::ast -> Source::value
2019-11-20 09:42:30 +03:00
Edwin Cheng
94c63d2802
Change to use Expansion::file_id and reordering
2019-11-19 22:56:28 +08:00
Edwin Cheng
ae49a22b5c
Rebase
2019-11-19 21:49:06 +08:00
Aleksey Kladov
fd52d721e1
More correct expansion mapping
...
We can't really map arbitrary ranges, we only can map tokens
2019-11-17 20:15:55 +03:00
Aleksey Kladov
2eaa8c94a8
Goto definition works inside macros
2019-11-16 17:00:54 +03:00
Aleksey Kladov
d898ecb8f2
Force passing Source when creating a SourceAnalyzer
2019-11-16 02:12:35 +03:00
Aleksey Kladov
1c819fc8f6
Prepare SourceAnalyzer for macros
2019-11-16 01:31:40 +03:00
Aleksey Kladov
0404e647e6
Prepare SourceAnalyzer for macros
2019-11-16 00:40:54 +03:00
Aleksey Kladov
bd8af6a413
Sourcify some more
2019-11-16 00:05:10 +03:00
Aleksey Kladov
4c90b7e2ec
Sourcify some things
...
If we want to support macros properly, we need to get rid of those
FileIds everywhere...
2019-11-15 23:24:56 +03:00
Aleksey Kladov
2f6c0c314b
Move scope tests to hir_def
2019-11-15 14:47:26 +03:00
Aleksey Kladov
9167da66ac
Reduce visibility
2019-11-15 14:15:04 +03:00
Aleksey Kladov
b80fa14a85
Use Local more
2019-11-15 12:00:36 +03:00
Aleksey Kladov
1583ab1558
Move body queries to hir_def
2019-11-14 17:37:22 +03:00
Aleksey Kladov
f924ae3b86
Move scopes to hir_def
2019-11-14 11:56:13 +03:00
Aleksey Kladov
da2ca01eba
Handle macro-generated expressions slightly less wrong
2019-11-14 10:30:30 +03:00
Aleksey Kladov
fe00db72b9
Remove owner from Body
2019-11-12 16:46:27 +03:00
Aleksey Kladov
c5a18c44e5
Introduce hir::GenericParam
...
Unlike existing hir::GenericParams, this is a global ID.
2019-11-11 17:36:27 +03:00
Aleksey Kladov
8b7f853cc1
Add hir::Local
2019-11-11 14:42:08 +03:00
Aleksey Kladov
ba2efca2bb
Move CrateDefMap to hir_def
2019-11-03 18:04:06 +03:00
Florian Diebold
8952380884
Change SourceAnalyzer method resoltion API
2019-11-01 20:01:21 +01:00
Florian Diebold
79cb0a0dab
Complete trait assoc items
2019-11-01 19:57:08 +01:00
Florian Diebold
1173c3dab5
Refactor to unify with method resolution
2019-11-01 19:57:08 +01:00
kjeremy
c46be83a34
Fixes #2143
2019-10-31 13:29:56 -04:00
kjeremy
b205a0ced3
source_binder => match_ast!
2019-10-30 16:08:27 -04:00
Aleksey Kladov
872ac566bf
push name down to hir_expand
2019-10-30 18:56:20 +03:00
Aleksey Kladov
e564334320
remove forward pointer to Path
2019-10-30 17:43:14 +03:00
Aleksey Kladov
f8ddef875a
remove forward pointer for name
2019-10-30 17:43:14 +03:00
Aleksey Kladov
c9cd6aa370
Move ids to hir_def crate
2019-10-30 13:11:38 +03:00
ice1000
6bad638928
Support inferring Self
type in enum definitions
...
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
2019-10-07 19:40:14 -04:00
Alexander Andreev
fdbd6bb11a
Added test for check doc strings in crates.
...
#1856
2019-09-30 11:58:53 +03:00
uHOOCCOOHu
2ecb126f5c
Support $crate
in item and expr place.
2019-09-27 02:05:06 +08:00
Shotaro Yamada
9c45a9e586
Remove redundant clone()
2019-09-25 10:32:01 +09:00
Ekaterina Babshukova
2867c40925
introduce FromSource trait
2019-09-19 19:38:27 +03:00
Florian Diebold
828d60574f
Refactor a bit to prepare for resolving trait assoc items
2019-09-17 19:47:45 +02:00
uHOOCCOOHu
7ed3be3291
Define known paths and group names
2019-09-15 20:14:33 +08:00
uHOOCCOOHu
4926bed426
Support path starting with a type
2019-09-15 19:40:32 +08:00
Aleksey Kladov
51e2d76b98
Specify desirable namespace when calling resolve
...
That way, we are able to get rid of a number of unreachable statements
2019-09-13 16:24:10 +03:00
Aleksey Kladov
63e1e63a91
start cleaning up the resolution
...
Nameres related types, like `PerNs<Resolution>`, can represent
unreasonable situations, like a local in a type namespace. We should
clean this up, by requiring that call-site specifies the kind of
resolution it expects.
2019-09-12 21:34:22 +03:00
Aleksey Kladov
6021a2a83a
cleanup hir db imports
2019-09-08 09:55:12 +03:00
Aleksey Kladov
9c3b25177e
Correctly build BodySourceMap for macro-expanded expressions
2019-09-03 11:04:38 +03:00
Aleksey Kladov
5e3f291195
fix hir for new block syntax
2019-09-02 21:23:19 +03:00
Florian Diebold
f92177cfb5
Add an expr_source method analogous to the source methods in the code model
...
... and use that instead of exposing the source map.
2019-09-02 14:56:38 +02:00
Aleksey Kladov
5b18a4eef9
rename struct -> record, pos -> tuple
2019-08-23 16:59:50 +03:00
Evgenii P
9f9c5aa659
rustfmt
2019-08-04 08:45:14 +07:00
Evgenii P
8597af8ed4
Idiomatic return
2019-08-04 08:08:46 +07:00
Evgenii P
d610adfc2b
Employ early return pattern more
2019-08-04 08:03:17 +07:00
Evgenii P
4034ea9e4e
source_binder.rs: fix order of imports
2019-08-04 07:56:29 +07:00
Evgenii P
6a94f203fc
Use std::future::Future trait from stdlib
2019-08-03 17:07:20 +07:00
Evgenii P
ab7774545c
Use future lang item instead of hardcoded std::future::Future
2019-08-03 01:53:51 +07:00
Evgenii P
30bc3b93be
rustfmt
2019-08-03 01:16:20 +07:00
Evgenii P
c417b98f02
Implement completion for the .await syntax
2019-08-03 01:15:43 +07:00
Ekaterina Babshukova
8e49bb664a
show local variable types in completion
2019-07-23 19:26:27 +03:00
Ekaterina Babshukova
5fe19d2fbd
provide completion in struct patterns
2019-07-21 14:41:33 +03:00
Aleksey Kladov
f3bdbec1b6
rename range -> text_range
2019-07-20 12:58:27 +03:00
Aleksey Kladov
5c594bcb48
cleanup casts
2019-07-19 18:22:00 +03:00
Aleksey Kladov
f9d9e0a1f7
several highlighting cleanups
...
* make stuff more type-safe by using `BindPat` instead of just `Pat`
* don't add `mut` into binding hash
* reset shadow counter when we enter a function
2019-07-19 16:09:32 +03:00
Aleksey Kladov
e2b28f5bb8
migrate ra_hir to the new rowan
2019-07-19 13:16:25 +03:00
Ekaterina Babshukova
2a1e11b36f
complete fields in enum variants
2019-07-12 20:31:49 +03:00
Aleksey Kladov
deab4caa7b
make Parse fields private
...
this is in preparation for the new rowan API
2019-07-12 19:41:13 +03:00
Aleksey Kladov
1834bae5b8
allow rustfmt to reorder imports
...
This wasn't a right decision in the first place, the feature flag was
broken in the last rustfmt release, and syntax highlighting of imports
is more important anyway
2019-07-04 23:09:09 +03:00
Florian Diebold
9c5e7dd849
Implement autoderef using the Deref trait
...
- add support for other lang item targets, since we need the Deref lang item
2019-06-15 18:21:23 +02:00
Aleksey Kladov
0145d06515
use Source for module, part 1
2019-06-11 18:28:51 +03:00
Aleksey Kladov
caefa6982b
remove some hacks from nameresolution for macros
2019-06-08 20:42:02 +03:00
Aleksey Kladov
780e1a365b
somewhat better name
2019-06-08 18:38:14 +03:00
Aleksey Kladov
1b783e33e9
one macro def should be enough
2019-06-08 14:48:56 +03:00
Alan Du
40424d4222
Fix clippy::identity_conversion
2019-06-04 18:05:07 -04:00
Edwin Cheng
371961be0e
Improve goto definition for MBE
2019-06-01 19:34:19 +08:00
Aleksey Kladov
c8bcfe6a05
fix syntax errors in tests
2019-05-28 18:07:39 +03:00
Aleksey Kladov
9cba67b2ad
simplify
2019-05-12 23:03:37 +03:00
Aleksey Kladov
98531dc785
simplify
2019-05-12 22:51:03 +03:00
bors[bot]
aa7bdfd37f
Merge #1208
...
1208: [WIP] Goto for Macro's r=matklad a=Lapz
Adds goto definition for macros. Currently only works for macros in the current crate ~~otherwise it panics~~. Proper macro resolution needs to be added for it to resolve macros in other crates.
Todo
- [X] Allow goto from macro calls
- [X] Fix panics
- [x] Add tests
![Screen Recording 2019-04-25 at 18 00 24](https://user-images.githubusercontent.com/19998186/56754499-1dd01c00-6785-11e9-9e9a-1e36de70cfa3.gif )
Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-05-04 18:38:10 +00:00
Lenard Pratt
8198e13c26
Added local macro goto
2019-05-04 17:39:51 +01:00
Florian Diebold
f43e69a64e
Handle recursive types in canonicalization
2019-05-04 18:25:36 +02:00
Florian Diebold
0ad7317b24
Canonicalize before doing method resolution
2019-05-04 18:18:30 +02:00
Aleksey Kladov
e01052d1f0
move auto-imoprter into IDE
...
auto-import is purely an IDE concern, so it should be done outside of
HIR
2019-04-22 15:56:28 +03:00
Andrea Pretto
200032852b
complete_import: prevent panic when the anchor is the completion source range
...
(fix rebase mess)
Please enter the commit message for your changes. Lines starting
2019-04-22 00:48:43 +02:00
Andrea Pretto
9144214958
complete_import: add new import resolver infrastructure with some hardcoded importable name.
...
Changes complete_scope to support that.
2019-04-22 00:14:58 +02:00
Florian Diebold
4f8a49f43c
Refactor method candidate generation a bit
...
This fixes the order in which candidates are chosen a bit (not completely
though, as the ignored test demonstrates), and makes autoderef work with trait
methods. As a side effect, this also makes completion of trait methods work :)
2019-04-14 21:53:35 +02:00
Aleksey Kladov
2facb5e061
cleanups
2019-04-13 14:16:46 +03:00
Aleksey Kladov
b260641e0c
slight encapsulation
2019-04-13 11:29:47 +03:00
Aleksey Kladov
f9e825d956
move ScopeEntryWithSyntax
2019-04-13 11:24:09 +03:00
Aleksey Kladov
d387bdccba
drop obsolete fixme
2019-04-13 11:21:32 +03:00
Aleksey Kladov
62d01dd4df
hide resolver
2019-04-13 11:00:15 +03:00
Aleksey Kladov
f4a94e74bc
fold ScopeWithSyntax into SourceAnalyzer
2019-04-13 10:49:01 +03:00
Aleksey Kladov
1e8569dce9
make private
2019-04-13 09:46:39 +03:00
Aleksey Kladov
d4043a8dba
only def-with-body remains
2019-04-13 09:45:52 +03:00
Aleksey Kladov
d88269bc2d
generalize
2019-04-13 09:38:37 +03:00
Aleksey Kladov
17a0e22883
simplify
2019-04-13 09:36:28 +03:00
Aleksey Kladov
65b0073653
simplify
2019-04-13 09:33:34 +03:00
Aleksey Kladov
9ead801a9c
make private
2019-04-13 09:32:25 +03:00
Aleksey Kladov
3aae223d93
hide some scopes
2019-04-13 09:31:03 +03:00
Aleksey Kladov
58fe5598e7
simplify
2019-04-13 01:32:43 +03:00
Aleksey Kladov
b0d8f9ff5d
make stuff private
2019-04-13 01:07:24 +03:00
Aleksey Kladov
81e91980dd
simplify
2019-04-13 01:05:18 +03:00
Aleksey Kladov
7c13e22334
simplify tests
2019-04-13 00:56:57 +03:00
Aleksey Kladov
0fd93bc14a
use really correct resolver for expressions
2019-04-13 00:44:47 +03:00
Aleksey Kladov
cf2ba2791d
add todo
2019-04-11 17:14:41 +03:00