Skip to main content

ExprKind

Enum ExprKind 

Source
pub enum ExprKind {
Show 33 variants Ident(InternedStr), IntLit(i64), UIntLit(u64), FloatLit(f64), CharLit(u8), StringLit(Vec<u8>), Index { expr: Box<Expr>, index: Box<Expr>, }, Call { func: Box<Expr>, args: Vec<Expr>, }, Member { expr: Box<Expr>, member: InternedStr, }, PtrMember { expr: Box<Expr>, member: InternedStr, }, PostInc(Box<Expr>), PostDec(Box<Expr>), CompoundLit { type_name: Box<TypeName>, init: Vec<InitializerItem>, }, PreInc(Box<Expr>), PreDec(Box<Expr>), AddrOf(Box<Expr>), Deref(Box<Expr>), UnaryPlus(Box<Expr>), UnaryMinus(Box<Expr>), BitNot(Box<Expr>), LogNot(Box<Expr>), Sizeof(Box<Expr>), SizeofType(Box<TypeName>), Alignof(Box<TypeName>), Cast { type_name: Box<TypeName>, expr: Box<Expr>, }, Binary { op: BinOp, lhs: Box<Expr>, rhs: Box<Expr>, }, Conditional { cond: Box<Expr>, then_expr: Box<Expr>, else_expr: Box<Expr>, }, Assign { op: AssignOp, lhs: Box<Expr>, rhs: Box<Expr>, }, Comma { lhs: Box<Expr>, rhs: Box<Expr>, }, StmtExpr(CompoundStmt), Assert { kind: AssertKind, condition: Box<Expr>, }, MacroCall { name: InternedStr, args: Vec<Expr>, expanded: Box<Expr>, call_loc: SourceLocation, }, BuiltinCall { name: InternedStr, args: Vec<BuiltinArg>, },
}
Expand description

式の種類

Variants§

§

Ident(InternedStr)

§

IntLit(i64)

§

UIntLit(u64)

§

FloatLit(f64)

§

CharLit(u8)

§

StringLit(Vec<u8>)

§

Index

Fields

§expr: Box<Expr>
§index: Box<Expr>
§

Call

Fields

§func: Box<Expr>
§args: Vec<Expr>
§

Member

Fields

§expr: Box<Expr>
§

PtrMember

Fields

§expr: Box<Expr>
§

PostInc(Box<Expr>)

§

PostDec(Box<Expr>)

§

CompoundLit

Fields

§type_name: Box<TypeName>
§

PreInc(Box<Expr>)

§

PreDec(Box<Expr>)

§

AddrOf(Box<Expr>)

§

Deref(Box<Expr>)

§

UnaryPlus(Box<Expr>)

§

UnaryMinus(Box<Expr>)

§

BitNot(Box<Expr>)

§

LogNot(Box<Expr>)

§

Sizeof(Box<Expr>)

§

SizeofType(Box<TypeName>)

§

Alignof(Box<TypeName>)

§

Cast

Fields

§type_name: Box<TypeName>
§expr: Box<Expr>
§

Binary

Fields

§lhs: Box<Expr>
§rhs: Box<Expr>
§

Conditional

Fields

§cond: Box<Expr>
§then_expr: Box<Expr>
§else_expr: Box<Expr>
§

Assign

Fields

§lhs: Box<Expr>
§rhs: Box<Expr>
§

Comma

Fields

§lhs: Box<Expr>
§rhs: Box<Expr>
§

StmtExpr(CompoundStmt)

§

Assert

アサーション式(マクロが空に展開されても保持)

Fields

§condition: Box<Expr>
§

MacroCall

マクロ呼び出し(元の呼び出し情報と展開結果を両方保持)

全てのマクロを常に展開しながら、元のマクロ呼び出し情報を AST に保持する。

  • expanded: 型推論・意味解析用の展開結果
  • nameargs: コード生成時にマクロ呼び出しを再構築

Fields

§name: InternedStr

マクロ名

§args: Vec<Expr>

元の引数(パース済み式)

§expanded: Box<Expr>

展開後の式(型推論・意味解析用)

§call_loc: SourceLocation

マクロ呼び出し位置

§

BuiltinCall

ビルトイン関数呼び出し(引数に型名を含みうる)

offsetof(type, member), __builtin_types_compatible_p(type1, type2) 等、 引数に型名を取りうるビルトイン関数をパースするための汎用ノード。

Fields

Trait Implementations§

Source§

impl Clone for ExprKind

Source§

fn clone(&self) -> ExprKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExprKind

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.