mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-13 08:27:17 +00:00
Rename BuiltinExpander to BuiltinFnLikeExpander
This commit is contained in:
parent
720ab0bef8
commit
6940ae9eab
3 changed files with 14 additions and 14 deletions
|
@ -9,7 +9,7 @@ use crate::{
|
|||
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 @@ 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 @@ mod tests {
|
|||
macro_rules! column {() => {}}
|
||||
column!()
|
||||
"#,
|
||||
BuiltinExpander::Column,
|
||||
BuiltinFnLikeExpander::Column,
|
||||
);
|
||||
|
||||
assert_eq!(expanded, "9");
|
||||
|
@ -243,7 +243,7 @@ mod tests {
|
|||
macro_rules! line {() => {}}
|
||||
line!()
|
||||
"#,
|
||||
BuiltinExpander::Line,
|
||||
BuiltinFnLikeExpander::Line,
|
||||
);
|
||||
|
||||
assert_eq!(expanded, "4");
|
||||
|
@ -257,7 +257,7 @@ mod tests {
|
|||
macro_rules! stringify {() => {}}
|
||||
stringify!(a b c)
|
||||
"#,
|
||||
BuiltinExpander::Stringify,
|
||||
BuiltinFnLikeExpander::Stringify,
|
||||
);
|
||||
|
||||
assert_eq!(expanded, "\"a b c\"");
|
||||
|
@ -271,7 +271,7 @@ mod tests {
|
|||
macro_rules! file {() => {}}
|
||||
file!()
|
||||
"#,
|
||||
BuiltinExpander::File,
|
||||
BuiltinFnLikeExpander::File,
|
||||
);
|
||||
|
||||
assert_eq!(expanded, "\"\"");
|
||||
|
|
|
@ -9,14 +9,14 @@ use ra_prof::profile;
|
|||
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 {
|
||||
|
|
|
@ -24,7 +24,7 @@ use ra_syntax::{
|
|||
};
|
||||
|
||||
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)]
|
||||
|
|
Loading…
Reference in a new issue