]> git.lizzy.rs Git - rust.git/commitdiff
Rename BuiltinExpander to BuiltinFnLikeExpander
authorEdwin Cheng <edwin0cheng@gmail.com>
Sat, 23 Nov 2019 13:54:39 +0000 (21:54 +0800)
committerEdwin Cheng <edwin0cheng@gmail.com>
Sat, 23 Nov 2019 13:54:39 +0000 (21:54 +0800)
crates/ra_hir_expand/src/builtin_macro.rs
crates/ra_hir_expand/src/db.rs
crates/ra_hir_expand/src/lib.rs

index d551f919854bbc886aadfc3f1510160d98c23955..a0069682d01ea37ae90d339b0e7921d65e886b6d 100644 (file)
@@ -9,7 +9,7 @@
 use crate::quote;
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub enum BuiltinExpander {
+pub enum BuiltinFnLikeExpander {
     Column,
     File,
     Line,
@@ -18,7 +18,7 @@ pub enum BuiltinExpander {
 
 struct BuiltInMacroInfo {
     name: name::Name,
-    kind: BuiltinExpander,
+    kind: BuiltinFnLikeExpander,
     expand: fn(
         db: &dyn AstDatabase,
         id: MacroCallId,
@@ -29,7 +29,7 @@ struct BuiltInMacroInfo {
 macro_rules! register_builtin {
     ( $(($name:ident, $kind: ident) => $expand:ident),* ) => {
         const BUILTIN_MACROS: &[BuiltInMacroInfo] = &[
-            $(BuiltInMacroInfo { name: name::$name, kind: BuiltinExpander::$kind, expand: $expand }),*
+            $(BuiltInMacroInfo { name: name::$name, kind: BuiltinFnLikeExpander::$kind, expand: $expand }),*
         ];
     };
 }
@@ -41,7 +41,7 @@ macro_rules! register_builtin {
     (STRINGIFY_MACRO, Stringify) => stringify_expand
 }
 
-impl BuiltinExpander {
+impl BuiltinFnLikeExpander {
     pub fn expand(
         &self,
         db: &dyn AstDatabase,
@@ -195,7 +195,7 @@ mod tests {
     use crate::{test_db::TestDB, MacroCallLoc};
     use ra_db::{fixture::WithFixture, SourceDatabase};
 
-    fn expand_builtin_macro(s: &str, expander: BuiltinExpander) -> String {
+    fn expand_builtin_macro(s: &str, expander: BuiltinFnLikeExpander) -> String {
         let (db, file_id) = TestDB::with_single_file(&s);
         let parsed = db.parse(file_id);
         let macro_calls: Vec<_> =
@@ -229,7 +229,7 @@ fn test_column_expand() {
         macro_rules! column {() => {}}
         column!()
 "#,
-            BuiltinExpander::Column,
+            BuiltinFnLikeExpander::Column,
         );
 
         assert_eq!(expanded, "9");
@@ -243,7 +243,7 @@ fn test_line_expand() {
         macro_rules! line {() => {}}
         line!()
 "#,
-            BuiltinExpander::Line,
+            BuiltinFnLikeExpander::Line,
         );
 
         assert_eq!(expanded, "4");
@@ -257,7 +257,7 @@ fn test_stringify_expand() {
         macro_rules! stringify {() => {}}
         stringify!(a b c)
 "#,
-            BuiltinExpander::Stringify,
+            BuiltinFnLikeExpander::Stringify,
         );
 
         assert_eq!(expanded, "\"a b c\"");
@@ -271,7 +271,7 @@ fn test_file_expand() {
         macro_rules! file {() => {}}
         file!()
 "#,
-            BuiltinExpander::File,
+            BuiltinFnLikeExpander::File,
         );
 
         assert_eq!(expanded, "\"\"");
index e1d93a8ef535bfca8cbf8bf63a9e60ae9b763288..8e46fa177d65bcd08c3599a9a7782c69d13b4ba5 100644 (file)
@@ -9,14 +9,14 @@
 use ra_syntax::{AstNode, Parse, SyntaxNode};
 
 use crate::{
-    ast_id_map::AstIdMap, BuiltinExpander, HirFileId, HirFileIdRepr, MacroCallId, MacroCallLoc,
-    MacroDefId, MacroDefKind, MacroFile, MacroFileKind,
+    ast_id_map::AstIdMap, BuiltinFnLikeExpander, HirFileId, HirFileIdRepr, MacroCallId,
+    MacroCallLoc, MacroDefId, MacroDefKind, MacroFile, MacroFileKind,
 };
 
 #[derive(Debug, Clone, Eq, PartialEq)]
 pub enum TokenExpander {
     MacroRules(mbe::MacroRules),
-    Builtin(BuiltinExpander),
+    Builtin(BuiltinFnLikeExpander),
 }
 
 impl TokenExpander {
index f514a15e4e55660f6cb25e44e6a1749b840212d2..4f3ccf1d0ddb57aa08cd4812d6e5c5732ecaa804 100644 (file)
@@ -24,7 +24,7 @@
 };
 
 use crate::ast_id_map::FileAstId;
-use crate::builtin_macro::BuiltinExpander;
+use crate::builtin_macro::BuiltinFnLikeExpander;
 
 #[cfg(test)]
 mod test_db;
@@ -138,7 +138,7 @@ pub struct MacroDefId {
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub enum MacroDefKind {
     Declarative,
-    BuiltIn(BuiltinExpander),
+    BuiltIn(BuiltinFnLikeExpander),
 }
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]