Skip to main content

SemanticAnalyzer

Struct SemanticAnalyzer 

Source
pub struct SemanticAnalyzer<'a> { /* private fields */ }
Expand description

意味解析器

Implementations§

Source§

impl<'a> SemanticAnalyzer<'a>

Source

pub fn new( interner: &'a StringInterner, apidoc: Option<&'a ApidocDict>, fields_dict: Option<&'a FieldsDict>, ) -> Self

新しい意味解析器を作成

Source

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 を指定して意味解析器を作成

Source

pub fn set_macro_return_types(&mut self, cache: &'a HashMap<String, String>)

確定済みマクロの戻り値型キャッシュへの参照を設定

Source

pub fn set_macro_param_types( &mut self, cache: &'a HashMap<String, Vec<(String, String)>>, )

確定済みマクロのパラメータ型キャッシュへの参照を設定

Source

pub fn get_macro_return_type(&self, macro_name: &str) -> Option<&str>

マクロの戻り値型を取得

Source

pub fn get_macro_param_types( &self, macro_name: &str, ) -> Option<&Vec<(String, String)>>

マクロのパラメータ型を取得

Source

pub fn push_scope(&mut self)

新しいスコープを開始

Source

pub fn pop_scope(&mut self)

現在のスコープを終了

Source

pub fn define_symbol(&mut self, symbol: Symbol)

シンボルを現在のスコープに追加

Source

pub fn lookup_symbol(&self, name: InternedStr) -> Option<&Symbol>

シンボルを検索(現在のスコープから親スコープへ)

Source

pub fn begin_param_inference(&mut self, params: &[InternedStr])

制約収集モードを開始し、パラメータを型変数として登録

Source

pub fn end_param_inference(&mut self) -> HashMap<InternedStr, Type>

制約を解いて引数型を取得し、制約収集モードを終了

Source

pub fn resolve_decl_specs(&mut self, specs: &DeclSpecs) -> Type

DeclSpecs から Type を構築

Source

pub fn apply_declarator(&self, base_type: &Type, decl: &Declarator) -> Type

Declarator を適用して型を構築

Source

pub fn resolve_type_name(&self, type_name: &TypeName) -> Type

TypeName から型を解決

Source

pub fn process_declaration(&mut self, decl: &Declaration)

宣言を処理してシンボルを登録

Source

pub fn process_function_def(&mut self, func: &FunctionDef)

関数定義を処理

Source

pub fn process_compound_stmt(&mut self, stmt: &CompoundStmt)

複合文を処理

Source

pub fn set_macro_params(&mut self, params: &[InternedStr])

マクロパラメータを設定

Source

pub fn clear_macro_params(&mut self)

マクロパラメータをクリア

Source

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 名セット
Source

pub fn collect_stmt_constraints(&mut self, stmt: &Stmt, type_env: &mut TypeEnv)

文から式の型制約を収集(再帰的に走査)

文に含まれる式に対して collect_expr_constraints を呼び出す。

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.