Skip to main content

InlineFnDict

Struct InlineFnDict 

Source
pub struct InlineFnDict { /* private fields */ }
Expand description

inline 関数辞書

FunctionDef をそのまま保持し、型情報は AST から直接取得する。 各 inline 関数の呼び出し先(called_functions)と利用可能性も追跡する。

Implementations§

Source§

impl InlineFnDict

Source

pub fn new() -> Self

新しい辞書を作成

Source

pub fn insert(&mut self, name: InternedStr, func_def: FunctionDef)

inline 関数を登録

Source

pub fn get(&self, name: InternedStr) -> Option<&FunctionDef>

inline 関数を取得

Source

pub fn iter(&self) -> impl Iterator<Item = (&InternedStr, &FunctionDef)>

全ての inline 関数を走査

Source

pub fn len(&self) -> usize

inline 関数の数

Source

pub fn is_empty(&self) -> bool

辞書が空かどうか

Source

pub fn get_called_functions( &self, name: InternedStr, ) -> Option<&HashSet<InternedStr>>

inline 関数の呼び出し先を取得

Source

pub fn is_calls_unavailable(&self, name: InternedStr) -> bool

利用不可関数を呼び出すかどうか

Source

pub fn set_calls_unavailable(&mut self, name: InternedStr)

利用不可フラグを設定

Source

pub fn is_apidoc_suppressed(&self, name: InternedStr) -> bool

apidoc skip_codegen 対象かどうか

Source

pub fn set_apidoc_suppressed(&mut self, name: InternedStr)

apidoc skip_codegen フラグを設定

Source

pub fn is_unavailable_for_codegen(&self, name: InternedStr) -> bool

出力可否の総合判定

calls_unavailable(不在関数を呼ぶ/推移的)または apidoc_suppressed(自分が skip_codegen 対象)のいずれかが立っていれば codegen 対象外。

Source

pub fn apply_apidoc_suppressions( &mut self, patches: &ApidocPatchSet, interner: &StringInterner, ) -> usize

apidoc skip_codegen を apidoc_suppressed 集合に反映

patches.skip_codegen の各エントリ名を interner で解決し、 該当する inline 関数が辞書に登録されていれば apidoc_suppressed に追加する。マッチした関数数を返す(マクロ側のマッチは MacroInferContext::apply_apidoc_suppressions が別途扱う)。

Source

pub fn called_functions_iter( &self, ) -> impl Iterator<Item = (&InternedStr, &HashSet<InternedStr>)>

called_functions の全エントリを走査

Source

pub fn collect_from_function_def( &mut self, func_def: &FunctionDef, interner: &StringInterner, )

FunctionDef から inline 関数を収集

inline または static(内部リンケージ)の関数を対象とする。 STATIC (= static) のみで inline でない関数も翻訳単位ローカルなため Rust 側に独自に持つ意味論的問題はない(bodies_by_type 配列と同じ理屈)。 例: perlstatic.hPerl_croak_memory_wrap (STATIC void) を取り込む ことで、これを呼ぶ inline 関数 (Perl_newSV_type 等) のカスケード解消に 寄与する。

assert/assert_ 呼び出しを Assert 式に変換してから保存する。 関数呼び出し先(called_functions)も同時に収集する。

Trait Implementations§

Source§

impl Debug for InlineFnDict

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InlineFnDict

Source§

fn default() -> InlineFnDict

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.