Skip to main content

Op

Enum Op 

Source
pub(crate) enum Op {
Show 73 variants Const(u32), This, Load(u32, u32), Pop, Binary(BinaryOp), JumpIfFalse(u32), Jump(u32), AndKeep(u32), OrKeep(u32), NullishKeep(u32), AndKeepMember(u32), OrKeepMember(u32), NullishKeepMember(u32), AndKeepIndex(u32), OrKeepIndex(u32), NullishKeepIndex(u32), JumpIfNullish(u32), JumpIfNullishMethod(u32), Member(u32, *const Expression, u32), Index, Method(u32, *const Expression, u32), MethodIndex, Call(u32, *const Expression), CallWithArgs(*const Expression), Not, Neg, Pos, BitNot, TypeOf, TypeofIdent(u32, u32), DeclVar(*const Pattern, u32), DeclLexical(u32), EnterBlock, LeaveBlocks(u32), RefreshForLet, StoreIdent(*const Expression, u32), AddAssignIdent(*const Expression, u32), StoreMember(u32), StoreIndex, Dup, Dup2, UpdateIdent { name: u32, target: *const Expression, delta: f64, prefix: bool, slot: u32, }, UpdateMember { name: u32, object: *const Expression, delta: f64, prefix: bool, slot: u32, }, UpdateIndex { delta: f64, prefix: bool, }, DeleteMember(u32), DeleteIndex, Array(u32), NewArray, ArrayPush, ArraySpread, NewObject, InitProp(u32), InitPropComputed, SpreadObject, New(u32), Template(*const Vec<String>, u32), CaseEq(u32), IterInit(bool), IterInitOrExec(bool, u32), IterNext { exit: u32, name: u32, slot: u32, is_lexical: bool, }, IterNextPush { exit: u32, is_lexical: bool, }, BindPattern(*const Pattern, bool), EnterTry(u32), LeaveTry(u32), CatchParam(u32), NewTarget, Closure(*const Expression), Regex(*const (String, String)), Return, ReturnUndefined, Throw, Eval(*const Expression), Exec { stmt: *const Statement, brk: u32, cont: u32, brk_depth: u16, cont_depth: u16, brk_try: u16, cont_try: u16, brk_iters: u16, cont_iters: u16, lbls: u32, },
}

Variants§

§

Const(u32)

定数を積む。

§

This

§

Load(u32, u32)

変数を読む(Expression::Identifier と同じ)。2 つ目は Code::slots の番号。

§

Pop

§

Binary(BinaryOp)

§

JumpIfFalse(u32)

スタックの値が偽なら飛ぶ(値は取り除く)。

§

Jump(u32)

§

AndKeep(u32)

&&: 偽なら値を残して飛ぶ。真なら取り除いて続ける。

§

OrKeep(u32)

||: 真なら値を残して飛ぶ。偽なら取り除いて続ける。

§

NullishKeep(u32)

??: null/undefined でなければ値を残して飛ぶ。

§

AndKeepMember(u32)

メンバー論理代入: [obj, v] で短絡なら obj を消して飛ぶ。短絡でないなら v を pop して [obj] で次へ。

§

OrKeepMember(u32)

§

NullishKeepMember(u32)

§

AndKeepIndex(u32)

インデックス論理代入: [obj, key, v] で短絡なら obj, key を消して飛ぶ。短絡でないなら v を pop して [obj, key] で次へ。

§

OrKeepIndex(u32)

§

NullishKeepIndex(u32)

§

JumpIfNullish(u32)

?.: null/undefined なら undefined を積んでチェイン末尾へ飛ぶ。

§

JumpIfNullishMethod(u32)

?.(...)(メソッド): func が null/undefined なら [func, this] を pop して undefined を積んで飛ぶ。

§

Member(u32, *const Expression, u32)

obj.name(1 つ目は名前の番号、2 つ目は構文木、3 つ目は Code::prop_slots の番号)。

§

Index

obj[key]

§

Method(u32, *const Expression, u32)

obj.name(...) の呼び先: obj を取り、関数と this を積む。3 つ目は Code::prop_slots の番号。

§

MethodIndex

obj[key](...) の呼び先。

§

Call(u32, *const Expression)

関数・this・引数をスタックから取って呼ぶ(式はエラーの文言用)。

§

CallWithArgs(*const Expression)

関数・this・引数配列をスタックから取って呼ぶ(引数スプレッド対応)。

§

Not

!x

§

Neg

-x

§

Pos

+x

§

BitNot

~x

§

TypeOf

typeof expr(識別子以外)

§

TypeofIdent(u32, u32)

typeof ident(未宣言でも例外にならない。1 つ目は名前の番号、2 つ目は Code::slots の番号)。

§

DeclVar(*const Pattern, u32)

var name = value(スタックの値を関数スコープへ束縛する)。

§

DeclLexical(u32)

let/const name = value(スタックの値を現在のスコープへ束縛する)。

§

EnterBlock

ブロックスコープに入る。

§

LeaveBlocks(u32)

ブロックスコープから n 段出る。

§

RefreshForLet

for (let/const ...) の反復の終わりに、クロージャに捕捉されていれば新しいスコープへ値を引き継ぐ。

§

StoreIdent(*const Expression, u32)

name = value(値は残す)。

§

AddAssignIdent(*const Expression, u32)

name += value(スタックの今の値と右辺を取り、結果を残す)。変数の文字列がほかから参照されていなければ末尾に足す。

§

StoreMember(u32)

obj.name = value(スタックの obj, value を取り、value を残す)。

§

StoreIndex

obj[key] = value(スタックの obj, key, value を取り、value を残す)。

§

Dup

スタックの先頭を複製する([..., a] -> [..., a, a])。

§

Dup2

スタックの先頭 2 個を複製する([..., a, b] -> [..., a, b, a, b])。

§

UpdateIdent

name++ など。

Fields

§name: u32
§delta: f64
§prefix: bool
§slot: u32
§

UpdateMember

obj.name++ など。

Fields

§name: u32
§delta: f64
§prefix: bool
§slot: u32
§

UpdateIndex

obj[key]++ など。

Fields

§delta: f64
§prefix: bool
§

DeleteMember(u32)

delete obj.name

§

DeleteIndex

delete obj[key]

§

Array(u32)

[e1, e2, ...](要素数)。

§

NewArray

空配列 [] の生成。

§

ArrayPush

配列末尾追加: [arr, val] -> [arr]

§

ArraySpread

配列スプレッド: [arr, iter] -> [arr](iter の全要素を arr の末尾へ追加)

§

NewObject

{} の生成。

§

InitProp(u32)

オブジェクトリテラルの通常プロパティ設定([obj, val] -> [obj])。

§

InitPropComputed

オブジェクトリテラルの算出プロパティ設定([obj, key, val] -> [obj])。

§

SpreadObject

オブジェクトスプレッド { ...src }: [obj, src] -> [obj]

§

New(u32)

new Callee(a1, a2, ...)(引数個数)。

§

Template(*const Vec<String>, u32)

テンプレートリテラル `...${e1}...`(quasis へのポインタ、式の数)。

§

CaseEq(u32)

switch の case: スタックの tv を取り、先頭の d と strict_eq なら d も取って飛ぶ。

§

IterInit(bool)

for-in / for-of の列挙配列と添字 0 を積む(true なら for-of)。

§

IterInitOrExec(bool, u32)

IterInit に、利用者定義の反復子(遅延反復と IteratorClose が要る)なら評価済みの値を木走査の for-of へ渡して 飛び先 exec へ飛ぶ分岐を足したもの(Wave F)。

§

IterNext

for-in / for-of の次の要素を取り出して変数に束縛する。終端なら exit へ飛ぶ。

Fields

§exit: u32
§name: u32
§slot: u32
§is_lexical: bool
§

IterNextPush

for-in / for-of の次の要素を取り出してスタックへ積む(分割代入用)。終端なら exit へ飛ぶ。

Fields

§exit: u32
§is_lexical: bool
§

BindPattern(*const Pattern, bool)

分割代入パターン({ a, b }, [x, y])をスタックトップの値から束縛する(true なら関数スコープ)。

§

EnterTry(u32)

try ブロック開始(例外発生時の catch 飛び先)。

§

LeaveTry(u32)

try ブロック正常脱出(n 段のハンドラを外す)。

§

CatchParam(u32)

catch (e) の例外値を現在のスコープへ束縛する。

§

NewTarget

new.target をスタックへ積む。

§

Closure(*const Expression)

関数式・アロー関数式(クロージャ)を生成してスタックへ積む。

§

Regex(*const (String, String))

正規表現リテラルを生成してスタックへ積む。

§

Return

§

ReturnUndefined

§

Throw

throw expr

§

Eval(*const Expression)

式を構文木のまま評価して積む。

§

Exec

文を構文木のまま実行する。break・continue は囲むループの飛び先へ。

Fields

§brk: u32
§cont: u32
§brk_depth: u16
§cont_depth: u16
§brk_try: u16
§cont_try: u16
§brk_iters: u16
§cont_iters: u16
§lbls: u32

Code::exec_labels の番号(ラベル付き break/continue の飛び先の表。無ければ NO_LOOP)。

Auto Trait Implementations§

§

impl !RefUnwindSafe for Op

§

impl !Send for Op

§

impl !Sync for Op

§

impl !UnwindSafe for Op

§

impl Freeze for Op

§

impl Unpin for Op

§

impl UnsafeUnpin for Op

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.