mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Rename intern_macro -> intern_macro_call
This commit is contained in:
parent
2d7f5891f7
commit
5c0b895f69
10 changed files with 32 additions and 32 deletions
|
@ -5,7 +5,7 @@
|
||||||
//! But we need this for at least LRU caching at the query level.
|
//! But we need this for at least LRU caching at the query level.
|
||||||
pub use hir_def::db::*;
|
pub use hir_def::db::*;
|
||||||
pub use hir_expand::db::{
|
pub use hir_expand::db::{
|
||||||
AstDatabase, AstDatabaseStorage, AstIdMapQuery, HygieneFrameQuery, InternMacroQuery,
|
AstDatabase, AstDatabaseStorage, AstIdMapQuery, HygieneFrameQuery, InternMacroCallQuery,
|
||||||
MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroExpansionQuery,
|
MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroExpansionQuery,
|
||||||
};
|
};
|
||||||
pub use hir_ty::db::*;
|
pub use hir_ty::db::*;
|
||||||
|
|
|
@ -842,7 +842,7 @@ impl<'db> SemanticsImpl<'db> {
|
||||||
fn resolve_attr_macro_call(&self, item: &ast::Item) -> Option<MacroDef> {
|
fn resolve_attr_macro_call(&self, item: &ast::Item) -> Option<MacroDef> {
|
||||||
let item_in_file = self.find_file(item.syntax().clone()).with_value(item.clone());
|
let item_in_file = self.find_file(item.syntax().clone()).with_value(item.clone());
|
||||||
let macro_call_id = self.with_ctx(|ctx| ctx.item_to_macro_call(item_in_file))?;
|
let macro_call_id = self.with_ctx(|ctx| ctx.item_to_macro_call(item_in_file))?;
|
||||||
Some(MacroDef { id: self.db.lookup_intern_macro(macro_call_id).def })
|
Some(MacroDef { id: self.db.lookup_intern_macro_call(macro_call_id).def })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_path(&self, path: &ast::Path) -> Option<PathResolution> {
|
fn resolve_path(&self, path: &ast::Path) -> Option<PathResolution> {
|
||||||
|
|
|
@ -1141,7 +1141,7 @@ impl DefCollector<'_> {
|
||||||
&resolver,
|
&resolver,
|
||||||
) {
|
) {
|
||||||
Ok(call_id) => {
|
Ok(call_id) => {
|
||||||
let loc: MacroCallLoc = self.db.lookup_intern_macro(call_id);
|
let loc: MacroCallLoc = self.db.lookup_intern_macro_call(call_id);
|
||||||
if let MacroDefKind::ProcMacro(exp, ..) = &loc.def.kind {
|
if let MacroDefKind::ProcMacro(exp, ..) = &loc.def.kind {
|
||||||
if exp.is_dummy() {
|
if exp.is_dummy() {
|
||||||
// Proc macros that cannot be expanded are treated as not
|
// Proc macros that cannot be expanded are treated as not
|
||||||
|
@ -1214,7 +1214,7 @@ impl DefCollector<'_> {
|
||||||
// First, fetch the raw expansion result for purposes of error reporting. This goes through
|
// First, fetch the raw expansion result for purposes of error reporting. This goes through
|
||||||
// `macro_expand_error` to avoid depending on the full expansion result (to improve
|
// `macro_expand_error` to avoid depending on the full expansion result (to improve
|
||||||
// incrementality).
|
// incrementality).
|
||||||
let loc: MacroCallLoc = self.db.lookup_intern_macro(macro_call_id);
|
let loc: MacroCallLoc = self.db.lookup_intern_macro_call(macro_call_id);
|
||||||
let err = self.db.macro_expand_error(macro_call_id);
|
let err = self.db.macro_expand_error(macro_call_id);
|
||||||
if let Some(err) = err {
|
if let Some(err) = err {
|
||||||
let diag = match err {
|
let diag = match err {
|
||||||
|
|
|
@ -168,7 +168,7 @@ fn find_builtin_crate(db: &dyn AstDatabase, id: MacroCallId) -> tt::TokenTree {
|
||||||
// FIXME: make hygiene works for builtin derive macro
|
// FIXME: make hygiene works for builtin derive macro
|
||||||
// such that $crate can be used here.
|
// such that $crate can be used here.
|
||||||
let cg = db.crate_graph();
|
let cg = db.crate_graph();
|
||||||
let krate = db.lookup_intern_macro(id).krate;
|
let krate = db.lookup_intern_macro_call(id).krate;
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
// All crates except core itself should have a dependency on core,
|
// All crates except core itself should have a dependency on core,
|
||||||
|
|
|
@ -326,7 +326,7 @@ fn cfg_expand(
|
||||||
id: MacroCallId,
|
id: MacroCallId,
|
||||||
tt: &tt::Subtree,
|
tt: &tt::Subtree,
|
||||||
) -> ExpandResult<tt::Subtree> {
|
) -> ExpandResult<tt::Subtree> {
|
||||||
let loc = db.lookup_intern_macro(id);
|
let loc = db.lookup_intern_macro_call(id);
|
||||||
let expr = CfgExpr::parse(tt);
|
let expr = CfgExpr::parse(tt);
|
||||||
let enabled = db.crate_graph()[loc.krate].cfg_options.check(&expr) != Some(false);
|
let enabled = db.crate_graph()[loc.krate].cfg_options.check(&expr) != Some(false);
|
||||||
let expanded = if enabled { quote!(true) } else { quote!(false) };
|
let expanded = if enabled { quote!(true) } else { quote!(false) };
|
||||||
|
@ -338,7 +338,7 @@ fn panic_expand(
|
||||||
id: MacroCallId,
|
id: MacroCallId,
|
||||||
tt: &tt::Subtree,
|
tt: &tt::Subtree,
|
||||||
) -> ExpandResult<tt::Subtree> {
|
) -> ExpandResult<tt::Subtree> {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(id);
|
||||||
// Expand to a macro call `$crate::panic::panic_{edition}`
|
// Expand to a macro call `$crate::panic::panic_{edition}`
|
||||||
let krate = tt::Ident { text: "$crate".into(), id: tt::TokenId::unspecified() };
|
let krate = tt::Ident { text: "$crate".into(), id: tt::TokenId::unspecified() };
|
||||||
let mut call = if db.crate_graph()[loc.krate].edition == Edition::Edition2021 {
|
let mut call = if db.crate_graph()[loc.krate].edition == Edition::Edition2021 {
|
||||||
|
@ -531,7 +531,7 @@ fn include_str_expand(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_env_inner(db: &dyn AstDatabase, arg_id: MacroCallId, key: &str) -> Option<String> {
|
fn get_env_inner(db: &dyn AstDatabase, arg_id: MacroCallId, key: &str) -> Option<String> {
|
||||||
let krate = db.lookup_intern_macro(arg_id).krate;
|
let krate = db.lookup_intern_macro_call(arg_id).krate;
|
||||||
db.crate_graph()[krate].env.get(key)
|
db.crate_graph()[krate].env.get(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ pub trait AstDatabase: SourceDatabase {
|
||||||
/// We encode macro definitions into ids of macro calls, this what allows us
|
/// We encode macro definitions into ids of macro calls, this what allows us
|
||||||
/// to be incremental.
|
/// to be incremental.
|
||||||
#[salsa::interned]
|
#[salsa::interned]
|
||||||
fn intern_macro(&self, macro_call: MacroCallLoc) -> MacroCallId;
|
fn intern_macro_call(&self, macro_call: MacroCallLoc) -> MacroCallId;
|
||||||
|
|
||||||
/// Lowers syntactic macro call to a token tree representation.
|
/// Lowers syntactic macro call to a token tree representation.
|
||||||
#[salsa::transparent]
|
#[salsa::transparent]
|
||||||
|
@ -139,7 +139,7 @@ pub fn expand_speculative(
|
||||||
speculative_args: &SyntaxNode,
|
speculative_args: &SyntaxNode,
|
||||||
token_to_map: SyntaxToken,
|
token_to_map: SyntaxToken,
|
||||||
) -> Option<(SyntaxNode, SyntaxToken)> {
|
) -> Option<(SyntaxNode, SyntaxToken)> {
|
||||||
let loc = db.lookup_intern_macro(actual_macro_call);
|
let loc = db.lookup_intern_macro_call(actual_macro_call);
|
||||||
let macro_def = db.macro_def(loc.def).ok()?;
|
let macro_def = db.macro_def(loc.def).ok()?;
|
||||||
let token_range = token_to_map.text_range();
|
let token_range = token_to_map.text_range();
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ fn parse_macro_expansion(
|
||||||
// Note:
|
// Note:
|
||||||
// The final goal we would like to make all parse_macro success,
|
// The final goal we would like to make all parse_macro success,
|
||||||
// such that the following log will not call anyway.
|
// such that the following log will not call anyway.
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
let node = loc.kind.to_node(db);
|
let node = loc.kind.to_node(db);
|
||||||
|
|
||||||
// collect parent information for warning log
|
// collect parent information for warning log
|
||||||
|
@ -296,7 +296,7 @@ fn parse_macro_expansion(
|
||||||
|
|
||||||
fn macro_arg(db: &dyn AstDatabase, id: MacroCallId) -> Option<Arc<(tt::Subtree, mbe::TokenMap)>> {
|
fn macro_arg(db: &dyn AstDatabase, id: MacroCallId) -> Option<Arc<(tt::Subtree, mbe::TokenMap)>> {
|
||||||
let arg = db.macro_arg_text(id)?;
|
let arg = db.macro_arg_text(id)?;
|
||||||
let loc = db.lookup_intern_macro(id);
|
let loc = db.lookup_intern_macro_call(id);
|
||||||
|
|
||||||
let node = SyntaxNode::new_root(arg);
|
let node = SyntaxNode::new_root(arg);
|
||||||
let censor = censor_for_macro_input(&loc, &node);
|
let censor = censor_for_macro_input(&loc, &node);
|
||||||
|
@ -339,7 +339,7 @@ fn censor_for_macro_input(loc: &MacroCallLoc, node: &SyntaxNode) -> FxHashSet<Sy
|
||||||
}
|
}
|
||||||
|
|
||||||
fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option<GreenNode> {
|
fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option<GreenNode> {
|
||||||
let loc = db.lookup_intern_macro(id);
|
let loc = db.lookup_intern_macro_call(id);
|
||||||
let arg = loc.kind.arg(db)?;
|
let arg = loc.kind.arg(db)?;
|
||||||
if matches!(loc.kind, MacroCallKind::FnLike { .. }) {
|
if matches!(loc.kind, MacroCallKind::FnLike { .. }) {
|
||||||
let first = arg.first_child_or_token().map_or(T![.], |it| it.kind());
|
let first = arg.first_child_or_token().map_or(T![.], |it| it.kind());
|
||||||
|
@ -402,7 +402,7 @@ fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Result<Arc<TokenExpander>,
|
||||||
|
|
||||||
fn macro_expand(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult<Option<Arc<tt::Subtree>>> {
|
fn macro_expand(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult<Option<Arc<tt::Subtree>>> {
|
||||||
let _p = profile::span("macro_expand");
|
let _p = profile::span("macro_expand");
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(id);
|
||||||
if let Some(eager) = &loc.eager {
|
if let Some(eager) = &loc.eager {
|
||||||
return ExpandResult {
|
return ExpandResult {
|
||||||
value: Some(eager.arg_or_expansion.clone()),
|
value: Some(eager.arg_or_expansion.clone()),
|
||||||
|
@ -443,7 +443,7 @@ fn macro_expand_error(db: &dyn AstDatabase, macro_call: MacroCallId) -> Option<E
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expand_proc_macro(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult<tt::Subtree> {
|
fn expand_proc_macro(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult<tt::Subtree> {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(id);
|
||||||
let macro_arg = match db.macro_arg(id) {
|
let macro_arg = match db.macro_arg(id) {
|
||||||
Some(it) => it,
|
Some(it) => it,
|
||||||
None => return ExpandResult::str_err("No arguments for proc-macro".to_string()),
|
None => return ExpandResult::str_err("No arguments for proc-macro".to_string()),
|
||||||
|
@ -488,7 +488,7 @@ fn hygiene_frame(db: &dyn AstDatabase, file_id: HirFileId) -> Arc<HygieneFrame>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn macro_expand_to(db: &dyn AstDatabase, id: MacroCallId) -> ExpandTo {
|
fn macro_expand_to(db: &dyn AstDatabase, id: MacroCallId) -> ExpandTo {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(id);
|
||||||
loc.kind.expand_to()
|
loc.kind.expand_to()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ pub fn expand_eager_macro(
|
||||||
// When `lazy_expand` is called, its *parent* file must be already exists.
|
// When `lazy_expand` is called, its *parent* file must be already exists.
|
||||||
// Here we store an eager macro id for the argument expanded subtree here
|
// Here we store an eager macro id for the argument expanded subtree here
|
||||||
// for that purpose.
|
// for that purpose.
|
||||||
let arg_id = db.intern_macro(MacroCallLoc {
|
let arg_id = db.intern_macro_call(MacroCallLoc {
|
||||||
def,
|
def,
|
||||||
krate,
|
krate,
|
||||||
eager: Some(EagerCallInfo {
|
eager: Some(EagerCallInfo {
|
||||||
|
@ -157,7 +157,7 @@ pub fn expand_eager_macro(
|
||||||
kind: MacroCallKind::FnLike { ast_id: call_id, expand_to },
|
kind: MacroCallKind::FnLike { ast_id: call_id, expand_to },
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(db.intern_macro(loc))
|
Ok(db.intern_macro_call(loc))
|
||||||
} else {
|
} else {
|
||||||
panic!("called `expand_eager_macro` on non-eager macro def {:?}", def);
|
panic!("called `expand_eager_macro` on non-eager macro def {:?}", def);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ impl HygieneInfo {
|
||||||
let token_id = self.exp_map.token_by_range(token)?;
|
let token_id = self.exp_map.token_by_range(token)?;
|
||||||
let (mut token_id, origin) = self.macro_def.map_id_up(token_id);
|
let (mut token_id, origin) = self.macro_def.map_id_up(token_id);
|
||||||
|
|
||||||
let loc = db.lookup_intern_macro(self.file.macro_call_id);
|
let loc = db.lookup_intern_macro_call(self.file.macro_call_id);
|
||||||
|
|
||||||
let (token_map, tt) = match &loc.kind {
|
let (token_map, tt) = match &loc.kind {
|
||||||
MacroCallKind::Attr { attr_args, .. } => match self.macro_arg_shift.unshift(token_id) {
|
MacroCallKind::Attr { attr_args, .. } => match self.macro_arg_shift.unshift(token_id) {
|
||||||
|
@ -213,7 +213,7 @@ impl HygieneFrame {
|
||||||
let (info, krate, local_inner) = match file_id.0 {
|
let (info, krate, local_inner) = match file_id.0 {
|
||||||
HirFileIdRepr::FileId(_) => (None, None, false),
|
HirFileIdRepr::FileId(_) => (None, None, false),
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
let info =
|
let info =
|
||||||
make_hygiene_info(db, macro_file, &loc).map(|info| (loc.kind.file_id(), info));
|
make_hygiene_info(db, macro_file, &loc).map(|info| (loc.kind.file_id(), info));
|
||||||
match loc.def.kind {
|
match loc.def.kind {
|
||||||
|
|
|
@ -148,7 +148,7 @@ impl HirFileId {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HirFileIdRepr::FileId(file_id) => file_id,
|
HirFileIdRepr::FileId(file_id) => file_id,
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
let file_id = match &loc.eager {
|
let file_id = match &loc.eager {
|
||||||
Some(EagerCallInfo { included_file: Some(file), .. }) => (*file).into(),
|
Some(EagerCallInfo { included_file: Some(file), .. }) => (*file).into(),
|
||||||
_ => loc.kind.file_id(),
|
_ => loc.kind.file_id(),
|
||||||
|
@ -162,7 +162,7 @@ impl HirFileId {
|
||||||
let mut level = 0;
|
let mut level = 0;
|
||||||
let mut curr = self;
|
let mut curr = self;
|
||||||
while let HirFileIdRepr::MacroFile(macro_file) = curr.0 {
|
while let HirFileIdRepr::MacroFile(macro_file) = curr.0 {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
|
|
||||||
level += 1;
|
level += 1;
|
||||||
curr = loc.kind.file_id();
|
curr = loc.kind.file_id();
|
||||||
|
@ -175,7 +175,7 @@ impl HirFileId {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HirFileIdRepr::FileId(_) => None,
|
HirFileIdRepr::FileId(_) => None,
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
Some(loc.kind.to_node(db))
|
Some(loc.kind.to_node(db))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ impl HirFileId {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HirFileIdRepr::FileId(_) => None,
|
HirFileIdRepr::FileId(_) => None,
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
|
|
||||||
let arg_tt = loc.kind.arg(db)?;
|
let arg_tt = loc.kind.arg(db)?;
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ impl HirFileId {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HirFileIdRepr::FileId(_) => None,
|
HirFileIdRepr::FileId(_) => None,
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
let item = match loc.def.kind {
|
let item = match loc.def.kind {
|
||||||
MacroDefKind::BuiltInDerive(..) => loc.kind.to_node(db),
|
MacroDefKind::BuiltInDerive(..) => loc.kind.to_node(db),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
|
@ -245,7 +245,7 @@ impl HirFileId {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HirFileIdRepr::FileId(_) => false,
|
HirFileIdRepr::FileId(_) => false,
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
match loc.def.kind {
|
match loc.def.kind {
|
||||||
MacroDefKind::ProcMacro(_, ProcMacroKind::CustomDerive, _) => true,
|
MacroDefKind::ProcMacro(_, ProcMacroKind::CustomDerive, _) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -258,7 +258,7 @@ impl HirFileId {
|
||||||
pub fn is_include_macro(&self, db: &dyn db::AstDatabase) -> bool {
|
pub fn is_include_macro(&self, db: &dyn db::AstDatabase) -> bool {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
matches!(loc.eager, Some(EagerCallInfo { included_file: Some(_), .. }))
|
matches!(loc.eager, Some(EagerCallInfo { included_file: Some(_), .. }))
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -269,7 +269,7 @@ impl HirFileId {
|
||||||
pub fn is_attr_macro(&self, db: &dyn db::AstDatabase) -> bool {
|
pub fn is_attr_macro(&self, db: &dyn db::AstDatabase) -> bool {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HirFileIdRepr::MacroFile(macro_file) => {
|
HirFileIdRepr::MacroFile(macro_file) => {
|
||||||
let loc: MacroCallLoc = db.lookup_intern_macro(macro_file.macro_call_id);
|
let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||||
matches!(loc.kind, MacroCallKind::Attr { .. })
|
matches!(loc.kind, MacroCallKind::Attr { .. })
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -288,7 +288,7 @@ impl MacroDefId {
|
||||||
krate: CrateId,
|
krate: CrateId,
|
||||||
kind: MacroCallKind,
|
kind: MacroCallKind,
|
||||||
) -> MacroCallId {
|
) -> MacroCallId {
|
||||||
db.intern_macro(MacroCallLoc { def: self, krate, eager: None, kind })
|
db.intern_macro_call(MacroCallLoc { def: self, krate, eager: None, kind })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ast_id(&self) -> Either<AstId<ast::Macro>, AstId<ast::Fn>> {
|
pub fn ast_id(&self) -> Either<AstId<ast::Macro>, AstId<ast::Fn>> {
|
||||||
|
@ -402,7 +402,7 @@ impl ExpansionInfo {
|
||||||
HirFileIdRepr::FileId(_) => return None,
|
HirFileIdRepr::FileId(_) => return None,
|
||||||
HirFileIdRepr::MacroFile(macro_file) => macro_file.macro_call_id,
|
HirFileIdRepr::MacroFile(macro_file) => macro_file.macro_call_id,
|
||||||
};
|
};
|
||||||
let loc = db.lookup_intern_macro(call_id);
|
let loc = db.lookup_intern_macro_call(call_id);
|
||||||
|
|
||||||
let token_range = token.value.text_range();
|
let token_range = token.value.text_range();
|
||||||
match &loc.kind {
|
match &loc.kind {
|
||||||
|
@ -458,7 +458,7 @@ impl ExpansionInfo {
|
||||||
HirFileIdRepr::FileId(_) => return None,
|
HirFileIdRepr::FileId(_) => return None,
|
||||||
HirFileIdRepr::MacroFile(macro_file) => macro_file.macro_call_id,
|
HirFileIdRepr::MacroFile(macro_file) => macro_file.macro_call_id,
|
||||||
};
|
};
|
||||||
let loc = db.lookup_intern_macro(call_id);
|
let loc = db.lookup_intern_macro_call(call_id);
|
||||||
|
|
||||||
let (token_map, tt) = match &loc.kind {
|
let (token_map, tt) = match &loc.kind {
|
||||||
MacroCallKind::Attr { attr_args, .. } => match self.macro_arg_shift.unshift(token_id) {
|
MacroCallKind::Attr { attr_args, .. } => match self.macro_arg_shift.unshift(token_id) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ impl RootDatabase {
|
||||||
hir::db::ParseMacroExpansionQuery
|
hir::db::ParseMacroExpansionQuery
|
||||||
hir::db::MacroExpandQuery
|
hir::db::MacroExpandQuery
|
||||||
hir::db::HygieneFrameQuery
|
hir::db::HygieneFrameQuery
|
||||||
hir::db::InternMacroQuery
|
hir::db::InternMacroCallQuery
|
||||||
|
|
||||||
// DefDatabase
|
// DefDatabase
|
||||||
hir::db::FileItemTreeQuery
|
hir::db::FileItemTreeQuery
|
||||||
|
|
Loading…
Reference in a new issue