Aleksey Kladov
88c5b1282a
Rename GenericParam -> TypeParam
...
We don't have LifetimeParam yet, but they are planned!
2019-12-07 20:25:48 +01:00
Aleksey Kladov
f4f8b81474
Get the right analyzer for impls
2019-12-07 20:05:08 +01:00
Aleksey Kladov
8e9837df21
Remove idx and parent generics from generics
...
This makes `hir_def::GenericParams` flatter. The logic for
re-numbering the params is moved to hir instead.
2019-12-07 13:05:56 +01:00
Florian Diebold
b2c01f446e
Implement ancestors_with_macros in a better way
2019-12-06 21:53:31 +01:00
Florian Diebold
a565072dde
Try to make go to definition work in format!
...
SourceAnalyzer didn't work properly within expression macro expansions because
it didn't find the enclosing function. Fix this by going up the expansion chain
to find ancestors. This makes the test work, but apparently in real usage it's
still not working.
2019-12-06 21:25:22 +01:00
Florian Diebold
18f6a995d0
Add expansion infrastructure for derive macros
2019-12-05 17:23:09 +01:00
ice1000
38853459e3
Add ModuleSource::Block
2019-12-04 18:30:42 -05:00
ice1000
009437f5d9
Replace ra_hir_expand::either
with crate
2019-12-03 11:07:56 -05:00
Edwin Cheng
bb601e7eaf
Add BuiltinShadowMode
2019-11-30 23:29:21 +08:00
Aleksey Kladov
ccd1b0800a
Rename Source -> InFile
2019-11-28 12:50:26 +03:00
Aleksey Kladov
a87579500a
Move Ty
2019-11-27 21:16:00 +03:00
Aleksey Kladov
9fa46ff5c6
Use Id for variats
2019-11-27 16:25:01 +03:00
Aleksey Kladov
17680f6060
More decoupling
2019-11-27 16:02:33 +03:00
Aleksey Kladov
d569869f7a
Decouple more
2019-11-27 15:56:20 +03:00
Aleksey Kladov
825049bc62
Decouple
2019-11-27 12:34:26 +03:00
Aleksey Kladov
bed6869865
Cleanup
2019-11-26 22:56:07 +03:00
Edwin Cheng
447268ceac
Hide MacroCallLoc
2019-11-27 01:33:08 +08:00
bors[bot]
4822d26540
Merge #2406
...
2406: Add hygiene information to SourceAnalyzer r=matklad a=edwin0cheng
This should fix https://github.com/rust-analyzer/rust-analyzer/pull/2392#issuecomment-557964686
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-26 13:18:03 +00:00
Edwin Cheng
0623164c1d
Remove dbg!
2019-11-26 21:13:36 +08:00
Aleksey Kladov
e5eadb3390
Introduce hir::Type
...
It should provide a convenient API over more low-level Ty
2019-11-26 14:02:57 +03:00
Edwin Cheng
245a9b165a
Add hygiene information to SourceAnalyzer
2019-11-26 15:05:53 +08:00
Aleksey Kladov
5f39c5794e
Use GenericDefIdMore
2019-11-25 15:54:03 +03:00
Aleksey Kladov
8c3e372835
Remove Resolver from autoderef
...
Resolver holds onto too much context, including local scopes. Let's
try to pass in only what is necessary -- the trait environment.
2019-11-25 13:10:26 +03:00
Aleksey Kladov
e48430cbae
Simplify
2019-11-24 20:53:42 +03:00
Aleksey Kladov
63e3ea38d3
Don't redo field resolution in the IDE
2019-11-24 20:06:55 +03:00
Aleksey Kladov
e0b06cb672
Switch to StaticLoc for statics
2019-11-24 15:18:12 +03:00
Aleksey Kladov
f11237561c
Cleanup imports
2019-11-24 14:02:08 +03:00
Edwin Cheng
59e7234546
Add to_macro_file_kind
2019-11-22 02:38:14 +08:00
Aleksey Kladov
6d64798a23
Move resolver to hir_def
2019-11-21 15:39:09 +03:00
Aleksey Kladov
00684d708b
Decouple
2019-11-21 15:24:51 +03:00
Aleksey Kladov
eb53aa37a3
Split internal and user-visible ScopeDef
2019-11-21 15:13:46 +03:00
Aleksey Kladov
1312c57d34
Move ScopeDef
2019-11-21 14:21:26 +03:00
Aleksey Kladov
061e6c77b5
Decouple
2019-11-21 14:13:49 +03:00
Aleksey Kladov
621cf06156
Decouple
2019-11-21 13:48:05 +03:00
Aleksey Kladov
24964ca58e
Move expr resolver to resolve
2019-11-21 13:28:04 +03:00
Aleksey Kladov
0102fb4133
Decouple Resolver
2019-11-21 13:25:03 +03:00
Aleksey Kladov
6241cf9a59
Add HasResolver trait
2019-11-20 22:22:32 +03:00
Aleksey Kladov
111891dc2d
Move constants to new ID
...
This allows us to get rid of trait item index
2019-11-20 18:41:23 +03:00
Edwin Cheng
0a9c80053f
Fix expand macro
2019-11-20 21:33:01 +08:00
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