pub struct SemanticAnalyzer<'a> { /* private fields */ }Expand description
意味解析器
Implementations§
Source§impl<'a> SemanticAnalyzer<'a>
impl<'a> SemanticAnalyzer<'a>
Sourcepub fn new(
interner: &'a StringInterner,
apidoc: Option<&'a ApidocDict>,
fields_dict: Option<&'a FieldsDict>,
) -> Self
pub fn new( interner: &'a StringInterner, apidoc: Option<&'a ApidocDict>, fields_dict: Option<&'a FieldsDict>, ) -> Self
新しい意味解析器を作成
Sourcepub fn with_rust_decl_dict(
interner: &'a StringInterner,
apidoc: Option<&'a ApidocDict>,
fields_dict: Option<&'a FieldsDict>,
rust_decl_dict: Option<&'a RustDeclDict>,
inline_fn_dict: Option<&'a InlineFnDict>,
) -> Self
pub fn with_rust_decl_dict( interner: &'a StringInterner, apidoc: Option<&'a ApidocDict>, fields_dict: Option<&'a FieldsDict>, rust_decl_dict: Option<&'a RustDeclDict>, inline_fn_dict: Option<&'a InlineFnDict>, ) -> Self
RustDeclDict と InlineFnDict を指定して意味解析器を作成
Sourcepub fn set_macro_return_types(&mut self, cache: &'a HashMap<String, String>)
pub fn set_macro_return_types(&mut self, cache: &'a HashMap<String, String>)
確定済みマクロの戻り値型キャッシュへの参照を設定
Sourcepub fn set_macro_param_types(
&mut self,
cache: &'a HashMap<String, Vec<(String, String)>>,
)
pub fn set_macro_param_types( &mut self, cache: &'a HashMap<String, Vec<(String, String)>>, )
確定済みマクロのパラメータ型キャッシュへの参照を設定
Sourcepub fn get_macro_return_type(&self, macro_name: &str) -> Option<&str>
pub fn get_macro_return_type(&self, macro_name: &str) -> Option<&str>
マクロの戻り値型を取得
Sourcepub fn get_macro_param_types(
&self,
macro_name: &str,
) -> Option<&Vec<(String, String)>>
pub fn get_macro_param_types( &self, macro_name: &str, ) -> Option<&Vec<(String, String)>>
マクロのパラメータ型を取得
Sourcepub fn push_scope(&mut self)
pub fn push_scope(&mut self)
新しいスコープを開始
Sourcepub fn define_symbol(&mut self, symbol: Symbol)
pub fn define_symbol(&mut self, symbol: Symbol)
シンボルを現在のスコープに追加
Sourcepub fn lookup_symbol(&self, name: InternedStr) -> Option<&Symbol>
pub fn lookup_symbol(&self, name: InternedStr) -> Option<&Symbol>
シンボルを検索(現在のスコープから親スコープへ)
Sourcepub fn begin_param_inference(&mut self, params: &[InternedStr])
pub fn begin_param_inference(&mut self, params: &[InternedStr])
制約収集モードを開始し、パラメータを型変数として登録
Sourcepub fn end_param_inference(&mut self) -> HashMap<InternedStr, Type>
pub fn end_param_inference(&mut self) -> HashMap<InternedStr, Type>
制約を解いて引数型を取得し、制約収集モードを終了
Sourcepub fn resolve_decl_specs(&mut self, specs: &DeclSpecs) -> Type
pub fn resolve_decl_specs(&mut self, specs: &DeclSpecs) -> Type
DeclSpecs から Type を構築
Sourcepub fn apply_declarator(&self, base_type: &Type, decl: &Declarator) -> Type
pub fn apply_declarator(&self, base_type: &Type, decl: &Declarator) -> Type
Declarator を適用して型を構築
Sourcepub fn resolve_type_name(&self, type_name: &TypeName) -> Type
pub fn resolve_type_name(&self, type_name: &TypeName) -> Type
TypeName から型を解決
Sourcepub fn process_declaration(&mut self, decl: &Declaration)
pub fn process_declaration(&mut self, decl: &Declaration)
宣言を処理してシンボルを登録
Sourcepub fn process_function_def(&mut self, func: &FunctionDef)
pub fn process_function_def(&mut self, func: &FunctionDef)
関数定義を処理
Sourcepub fn process_compound_stmt(&mut self, stmt: &CompoundStmt)
pub fn process_compound_stmt(&mut self, stmt: &CompoundStmt)
複合文を処理
Sourcepub fn set_macro_params(&mut self, params: &[InternedStr])
pub fn set_macro_params(&mut self, params: &[InternedStr])
マクロパラメータを設定
Sourcepub fn clear_macro_params(&mut self)
pub fn clear_macro_params(&mut self)
マクロパラメータをクリア
Sourcepub fn register_macro_params_from_apidoc(
&mut self,
macro_name: InternedStr,
params: &[InternedStr],
files: &'a FileRegistry,
typedefs: &'a HashSet<InternedStr>,
)
pub fn register_macro_params_from_apidoc( &mut self, macro_name: InternedStr, params: &[InternedStr], files: &'a FileRegistry, typedefs: &'a HashSet<InternedStr>, )
マクロパラメータを apidoc 型情報付きでシンボルテーブルに登録
§Arguments
macro_name- マクロ名params- パラメータ名のリストfiles- ファイルレジストリtypedefs- typedef 名セット
Sourcepub fn collect_stmt_constraints(&mut self, stmt: &Stmt, type_env: &mut TypeEnv)
pub fn collect_stmt_constraints(&mut self, stmt: &Stmt, type_env: &mut TypeEnv)
文から式の型制約を収集(再帰的に走査)
文に含まれる式に対して collect_expr_constraints を呼び出す。
Sourcepub fn collect_expr_constraints(&mut self, expr: &Expr, type_env: &mut TypeEnv)
pub fn collect_expr_constraints(&mut self, expr: &Expr, type_env: &mut TypeEnv)
式全体から型制約を収集し、全式の型を計算(再帰的に走査)
子式を先に処理し、親式の型を後で計算する。
Auto Trait Implementations§
impl<'a> Freeze for SemanticAnalyzer<'a>
impl<'a> RefUnwindSafe for SemanticAnalyzer<'a>
impl<'a> Send for SemanticAnalyzer<'a>
impl<'a> Sync for SemanticAnalyzer<'a>
impl<'a> Unpin for SemanticAnalyzer<'a>
impl<'a> UnsafeUnpin for SemanticAnalyzer<'a>
impl<'a> UnwindSafe for SemanticAnalyzer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more