aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-11-23 13:54:39 +0000
committerEdwin Cheng <[email protected]>2019-11-23 13:54:39 +0000
commit6940ae9eab9ec8ea5fe81c8b30ccada4a62aebde (patch)
tree263b5fe3d1d7696e89283a0d398bbc7953b64a92 /crates/ra_hir_expand
parent720ab0bef8675bd4a61d0bd416bb865c864df670 (diff)
Rename BuiltinExpander to BuiltinFnLikeExpander
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r--crates/ra_hir_expand/src/builtin_macro.rs18
-rw-r--r--crates/ra_hir_expand/src/db.rs6
-rw-r--r--crates/ra_hir_expand/src/lib.rs4
3 files changed, 14 insertions, 14 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::{
9use crate::quote; 9use crate::quote;
10 10
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 11#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
12pub enum BuiltinExpander { 12pub enum BuiltinFnLikeExpander {
13 Column, 13 Column,
14 File, 14 File,
15 Line, 15 Line,
@@ -18,7 +18,7 @@ pub enum BuiltinExpander {
18 18
19struct BuiltInMacroInfo { 19struct 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 {
29macro_rules! register_builtin { 29macro_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
44impl BuiltinExpander { 44impl 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, "\"\"");
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index e1d93a8ef..8e46fa177 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -9,14 +9,14 @@ use ra_prof::profile;
9use ra_syntax::{AstNode, Parse, SyntaxNode}; 9use ra_syntax::{AstNode, Parse, SyntaxNode};
10 10
11use crate::{ 11use crate::{
12 ast_id_map::AstIdMap, BuiltinExpander, HirFileId, HirFileIdRepr, MacroCallId, MacroCallLoc, 12 ast_id_map::AstIdMap, BuiltinFnLikeExpander, HirFileId, HirFileIdRepr, MacroCallId,
13 MacroDefId, MacroDefKind, MacroFile, MacroFileKind, 13 MacroCallLoc, MacroDefId, MacroDefKind, MacroFile, MacroFileKind,
14}; 14};
15 15
16#[derive(Debug, Clone, Eq, PartialEq)] 16#[derive(Debug, Clone, Eq, PartialEq)]
17pub enum TokenExpander { 17pub enum TokenExpander {
18 MacroRules(mbe::MacroRules), 18 MacroRules(mbe::MacroRules),
19 Builtin(BuiltinExpander), 19 Builtin(BuiltinFnLikeExpander),
20} 20}
21 21
22impl TokenExpander { 22impl TokenExpander {
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index f514a15e4..4f3ccf1d0 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -24,7 +24,7 @@ use ra_syntax::{
24}; 24};
25 25
26use crate::ast_id_map::FileAstId; 26use crate::ast_id_map::FileAstId;
27use crate::builtin_macro::BuiltinExpander; 27use crate::builtin_macro::BuiltinFnLikeExpander;
28 28
29#[cfg(test)] 29#[cfg(test)]
30mod test_db; 30mod test_db;
@@ -138,7 +138,7 @@ pub struct MacroDefId {
138#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 138#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
139pub enum MacroDefKind { 139pub enum MacroDefKind {
140 Declarative, 140 Declarative,
141 BuiltIn(BuiltinExpander), 141 BuiltIn(BuiltinFnLikeExpander),
142} 142}
143 143
144#[derive(Debug, Clone, PartialEq, Eq, Hash)] 144#[derive(Debug, Clone, PartialEq, Eq, Hash)]