Commit Graph

92 Commits

Author SHA1 Message Date
bors[bot]
af5e2abe15
Merge #2614
2614: Clippy cleanup r=matklad a=kjeremy

Just a few tweaks from the latest clippy.  There are a lot more but we should probably tweak our settings.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 14:46:24 +00:00
kjeremy
133b4063a6 Remove useless clone 2019-12-20 09:43:01 -05:00
Edwin Cheng
dddee23f43 Add std::ops::Index support for infering 2019-12-19 12:45:07 +08:00
Edwin Cheng
2ea1cfd780 Rename range to by_kind 2019-12-18 11:36:10 +08:00
Edwin Cheng
320416d756 Add TokenTextRange 2019-12-18 11:20:22 +08:00
Edwin Cheng
59295854f8 Add token id to delims 2019-12-18 11:20:22 +08:00
Edwin Cheng
aceb9d7fb0 Add token ids for all tt::Leaf 2019-12-18 11:20:22 +08:00
bors[bot]
4a58522119
Merge #2562
2562: Fix NavigationTarget ranges r=matklad a=edwin0cheng

Fix the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/2544#issuecomment-565572553

This PR change the order for finding `full_range` of `focus_range` in following orders:
1. map both ranges to macro_call
2. map focus range to a token inside macro call, and full range to the whole of macro call
3. map both ranges to the whole of macro call

And fix the corresponding tests and make these tests easily to follow.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 13:37:32 +00:00
Edwin Cheng
b53587c7bd Re-export Origin to replace ExpansionOrigin 2019-12-15 01:46:39 +08:00
Edwin Cheng
61360fdfec Fix original_source find order 2019-12-15 01:24:51 +08:00
Florian Diebold
6911bc89a7 Rename N! to name! 2019-12-13 22:33:38 +01:00
Florian Diebold
259c42f00e Add macros for known names and paths 2019-12-13 22:33:37 +01:00
bors[bot]
9c9f4635b4
Merge #2550
2550: Infer - and ! using std::ops::{Neg, Not} r=flodiebold a=kiljacken

Found some low hanging fruit while taking a cursory look at index inferring.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-13 19:49:01 +00:00
Edwin Cheng
98f98cbb54 Refactor tt::Delimiter 2019-12-13 21:53:34 +08:00
Emil Lauridsen
7705209051 Correctly infer - and ! using std::ops::{Neg,Not} 2019-12-13 12:45:38 +01:00
Aleksey Kladov
82e9b24558 Move traits to the new loc 2019-12-12 14:36:14 +01:00
Florian Diebold
5e096def15 Expand macros in blocks to expressions for now
Expanding to statements isn't handled properly yet and breaks things.
2019-12-08 13:03:13 +01:00
Florian Diebold
91f28e43a2 Fix expansion of format_args 2019-12-08 13:02:52 +01:00
Edwin Cheng
509fedd9d2 Remove MacroFileKind 2019-12-08 16:16:52 +08:00
Florian Diebold
b2c01f446e Implement ancestors_with_macros in a better way 2019-12-06 21:53:31 +01:00
Florian Diebold
4a99ef5c39 Builtin macros only use caller tokens 2019-12-06 21:25:22 +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
eae425b10f Implement format_args more properly 2019-12-06 21:25:22 +01:00
Florian Diebold
3a5aa03e66 Remove unnecessary len parameter for Name::new_inline_ascii
I assume it was previously required because `len` was not const, but that
doesn't seem to be a problem anymore.
2019-12-06 21:25:22 +01:00
Florian Diebold
c5ffb0dc81 Add stub implementation of format_args{_nl} macros
Just enough to fix the huge amount of type mismatches they cause.
2019-12-06 21:25:22 +01:00
Florian Diebold
10697041c1 Implement all the other built-in derives
Since as long as we're not implementing the bodies, they all work the same way.
2019-12-05 19:52:52 +01:00
Florian Diebold
db8a00bd99 Implement derive(Copy, Clone) properly (well, kind of) 2019-12-05 19:29:57 +01:00
Florian Diebold
18f6a995d0 Add expansion infrastructure for derive macros 2019-12-05 17:23:09 +01:00
ice1000
009437f5d9 Replace ra_hir_expand::either with crate 2019-12-03 11:07:56 -05:00
oxalica
4992d2bf79
Infer range types 2019-11-29 03:10:16 +08:00
Aleksey Kladov
e823c578c9 Use InFile for AstId 2019-11-28 16:02:38 +03:00
Aleksey Kladov
ccd1b0800a Rename Source -> InFile 2019-11-28 12:50:26 +03:00
Edwin Cheng
447268ceac Hide MacroCallLoc 2019-11-27 01:33:08 +08:00
Aleksey Kladov
131c2da6bf ⬆️ salsa 2019-11-26 11:29:20 +03:00
bors[bot]
e00e6554dd
Merge #2362
2362: Expand compile_error! r=edwin0cheng a=kjeremy

Does not validate that the input is a string literal. I thought that I could `match_ast!` against the `macro_args` but that did not work. Even if it had I am not sure which error would be appropriate.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-25 04:51:42 +00:00
Jeremy Kolb
67d3600f59 Expand compile_error! 2019-11-24 19:01:51 -05:00
Marco Groppo
ceb13a0494 Fix panic during the expansion of column! 2019-11-24 23:49:58 +01:00
Edwin Cheng
16854e28ef Use macro for all the things 2019-11-23 22:48:34 +08:00
Edwin Cheng
6940ae9eab Rename BuiltinExpander to BuiltinFnLikeExpander 2019-11-23 21:54:39 +08:00
Edwin Cheng
720ab0bef8 Refactor builtin macro 2019-11-23 01:47:35 +08:00
Edwin Cheng
f4e78a5f4e Add TestDB 2019-11-23 01:11:33 +08:00
Jeremy Kolb
1ee5592be2 Expand column!() 2019-11-22 11:34:48 -05:00
kjeremy
786544f022 Expand file! to dummy "" 2019-11-22 10:05:04 -05:00
Piotr Szpetkowski
8ae5d6faf6
Add support for Stringify builtin macro 2019-11-22 07:56:50 +01:00
Edwin Cheng
4ff400833f Add MacroFileKind::Statements 2019-11-22 02:38:14 +08: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
f24bba74d0 Fixed a bug for string lit in quote 2019-11-19 12:15:20 +08:00
Aleksey Kladov
2b6f1ab0e2 Collapse TokenMap and RevTokenMap 2019-11-18 16:08:41 +03:00
Aleksey Kladov
b79d678923 Token-based reverse-mapping 2019-11-18 15:08:39 +03:00