From 2bb8956a102cb2efbea35e414a8214fba2efcaf6 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sun, 14 Mar 2021 18:00:11 +0800 Subject: Introduce FunctionQualifier for hir::FunctionData --- crates/hir_def/src/item_tree.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'crates/hir_def/src/item_tree.rs') diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 09bcb10dc..d8f22d442 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs @@ -24,7 +24,7 @@ use la_arena::{Arena, Idx, RawIdx}; use profile::Count; use rustc_hash::FxHashMap; use smallvec::SmallVec; -use syntax::{ast, match_ast, SyntaxKind}; +use syntax::{ast, match_ast, SmolStr, SyntaxKind}; use crate::{ attr::{Attrs, RawAttrs}, @@ -551,16 +551,25 @@ pub struct Function { pub generic_params: GenericParamsId, pub has_self_param: bool, pub has_body: bool, - pub is_unsafe: bool, + pub qualifier: FunctionQualifier, /// Whether the function is located in an `extern` block (*not* whether it is an /// `extern "abi" fn`). - pub is_extern: bool, + pub is_in_extern_block: bool, pub params: Box<[Idx]>, pub is_varargs: bool, pub ret_type: Idx, pub ast_id: FileAstId, } +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct FunctionQualifier { + pub is_default: bool, + pub is_const: bool, + pub is_async: bool, + pub is_unsafe: bool, + pub abi: Option, +} + #[derive(Debug, Clone, Eq, PartialEq)] pub struct Struct { pub name: Name, -- cgit v1.2.3