diff options
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_macro.rs')
-rw-r--r-- | crates/ra_hir_expand/src/builtin_macro.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index d551f9198..a0069682d 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs | |||
@@ -9,7 +9,7 @@ use crate::{ | |||
9 | use crate::quote; | 9 | use crate::quote; |
10 | 10 | ||
11 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 11 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
12 | pub enum BuiltinExpander { | 12 | pub enum BuiltinFnLikeExpander { |
13 | Column, | 13 | Column, |
14 | File, | 14 | File, |
15 | Line, | 15 | Line, |
@@ -18,7 +18,7 @@ pub enum BuiltinExpander { | |||
18 | 18 | ||
19 | struct BuiltInMacroInfo { | 19 | struct BuiltInMacroInfo { |
20 | name: name::Name, | 20 | name: name::Name, |
21 | kind: BuiltinExpander, | 21 | kind: BuiltinFnLikeExpander, |
22 | expand: fn( | 22 | expand: fn( |
23 | db: &dyn AstDatabase, | 23 | db: &dyn AstDatabase, |
24 | id: MacroCallId, | 24 | id: MacroCallId, |
@@ -29,7 +29,7 @@ struct BuiltInMacroInfo { | |||
29 | macro_rules! register_builtin { | 29 | macro_rules! register_builtin { |
30 | ( $(($name:ident, $kind: ident) => $expand:ident),* ) => { | 30 | ( $(($name:ident, $kind: ident) => $expand:ident),* ) => { |
31 | const BUILTIN_MACROS: &[BuiltInMacroInfo] = &[ | 31 | const BUILTIN_MACROS: &[BuiltInMacroInfo] = &[ |
32 | $(BuiltInMacroInfo { name: name::$name, kind: BuiltinExpander::$kind, expand: $expand }),* | 32 | $(BuiltInMacroInfo { name: name::$name, kind: BuiltinFnLikeExpander::$kind, expand: $expand }),* |
33 | ]; | 33 | ]; |
34 | }; | 34 | }; |
35 | } | 35 | } |
@@ -41,7 +41,7 @@ register_builtin! { | |||
41 | (STRINGIFY_MACRO, Stringify) => stringify_expand | 41 | (STRINGIFY_MACRO, Stringify) => stringify_expand |
42 | } | 42 | } |
43 | 43 | ||
44 | impl BuiltinExpander { | 44 | impl BuiltinFnLikeExpander { |
45 | pub fn expand( | 45 | pub fn expand( |
46 | &self, | 46 | &self, |
47 | db: &dyn AstDatabase, | 47 | db: &dyn AstDatabase, |
@@ -195,7 +195,7 @@ mod tests { | |||
195 | use crate::{test_db::TestDB, MacroCallLoc}; | 195 | use crate::{test_db::TestDB, MacroCallLoc}; |
196 | use ra_db::{fixture::WithFixture, SourceDatabase}; | 196 | use ra_db::{fixture::WithFixture, SourceDatabase}; |
197 | 197 | ||
198 | fn expand_builtin_macro(s: &str, expander: BuiltinExpander) -> String { | 198 | fn expand_builtin_macro(s: &str, expander: BuiltinFnLikeExpander) -> String { |
199 | let (db, file_id) = TestDB::with_single_file(&s); | 199 | let (db, file_id) = TestDB::with_single_file(&s); |
200 | let parsed = db.parse(file_id); | 200 | let parsed = db.parse(file_id); |
201 | let macro_calls: Vec<_> = | 201 | let macro_calls: Vec<_> = |
@@ -229,7 +229,7 @@ mod tests { | |||
229 | macro_rules! column {() => {}} | 229 | macro_rules! column {() => {}} |
230 | column!() | 230 | column!() |
231 | "#, | 231 | "#, |
232 | BuiltinExpander::Column, | 232 | BuiltinFnLikeExpander::Column, |
233 | ); | 233 | ); |
234 | 234 | ||
235 | assert_eq!(expanded, "9"); | 235 | assert_eq!(expanded, "9"); |
@@ -243,7 +243,7 @@ mod tests { | |||
243 | macro_rules! line {() => {}} | 243 | macro_rules! line {() => {}} |
244 | line!() | 244 | line!() |
245 | "#, | 245 | "#, |
246 | BuiltinExpander::Line, | 246 | BuiltinFnLikeExpander::Line, |
247 | ); | 247 | ); |
248 | 248 | ||
249 | assert_eq!(expanded, "4"); | 249 | assert_eq!(expanded, "4"); |
@@ -257,7 +257,7 @@ mod tests { | |||
257 | macro_rules! stringify {() => {}} | 257 | macro_rules! stringify {() => {}} |
258 | stringify!(a b c) | 258 | stringify!(a b c) |
259 | "#, | 259 | "#, |
260 | BuiltinExpander::Stringify, | 260 | BuiltinFnLikeExpander::Stringify, |
261 | ); | 261 | ); |
262 | 262 | ||
263 | assert_eq!(expanded, "\"a b c\""); | 263 | assert_eq!(expanded, "\"a b c\""); |
@@ -271,7 +271,7 @@ mod tests { | |||
271 | macro_rules! file {() => {}} | 271 | macro_rules! file {() => {}} |
272 | file!() | 272 | file!() |
273 | "#, | 273 | "#, |
274 | BuiltinExpander::File, | 274 | BuiltinFnLikeExpander::File, |
275 | ); | 275 | ); |
276 | 276 | ||
277 | assert_eq!(expanded, "\"\""); | 277 | assert_eq!(expanded, "\"\""); |