Skip to main content

GOp

Enum GOp 

Source
pub(crate) enum GOp {
Show 61 variants Eval(*const Expression), Exec(*const Statement, Option<Rc<Ctx>>), PushUndef, Pop, Dup, Dup2, Jump(u32), JumpIfFalse(u32), JumpIfTrue(u32), LogicKeep(u8, u32), LogicKeepUnder(u8, u32, u8), Yield, YieldStar, Await, Binary(BinaryOp), Unary(UnaryOp), AssignTo(*const Expression), GetMember(*const Rc<str>, *const Expression), GetIndex, ToKeyFor, ToKey, PutMember(*const Rc<str>), PutIndex, ResolveCallee(*const Expression, u32), CalleeMember(*const Rc<str>, *const Expression), CalleeIndex, CalleeValue, Call(u32, *const Expression), CallList(*const Expression), New(u32), NewList, ListNew, ListPush, ListSpread, ObjNew, ObjSpread, ObjProp(*const Property), ObjFunc(*const Property), ToStr, Template(*const Vec<String>), Hoist(*const [Statement], u8), PushBlock, PopScopes(u32), PushTdz(*const Pattern), ForLetCopy, DeclVar(*const Pattern, u8, bool), Return, Throw, JumpOut(u32), EnterTry(u32, u32), LeaveTry, CatchBind(*const Pattern, bool), PushFinallyNormal, EndFinally, SwitchScope(*const Vec<SwitchCase>), CaseEq(u32), IterOpen(u8), IterNext(u32), IterBindScope, BindPattern(*const Pattern), IterEnd,
}
Expand description

generator の命令。

Variants§

§

Eval(*const Expression)

式を構文木のまま評価して積む(yield を含まない式)。

§

Exec(*const Statement, Option<Rc<Ctx>>)

文を構文木のまま実行する(yield を含まない文)。break/continue/return は文脈から飛び先を引く。

§

PushUndef

§

Pop

§

Dup

§

Dup2

§

Jump(u32)

§

JumpIfFalse(u32)

値を取り除き、偽なら飛ぶ。

§

JumpIfTrue(u32)

値を取り除き、真なら飛ぶ。

§

LogicKeep(u8, u32)

論理演算(0=&& 1=|| 2=??): 短絡なら値を残して飛ぶ。短絡でなければ値を捨てる。

§

LogicKeepUnder(u8, u32, u8)

論理代入のメンバー/添字版: [x1..xn, cur] で短絡なら x1..xn を消して cur を残して飛ぶ。でなければ cur を捨てる。

§

Yield

§

YieldStar

§

Await

§

Binary(BinaryOp)

§

Unary(UnaryOp)

§

AssignTo(*const Expression)

[v] -> [v]: 代入先(識別子・分割代入のパターン)へ書く。

§

GetMember(*const Rc<str>, *const Expression)

[o] -> [o.name](式はエラーの文言用)。

§

GetIndex

[o, k] -> [o[k]]

§

ToKeyFor

[o, k] -> [o, ToPropertyKey の ToPrimitive(k)]

§

ToKey

[k] -> [ToPrimitive(k)]

§

PutMember(*const Rc<str>)

[o, v] -> [v]

§

PutIndex

[o, k, v] -> [v]

§

ResolveCallee(*const Expression, u32)

呼び先(yield を含まない式)を this 込みで解決して [f, this] を積む。optional chain で短絡したら undefined を積んで飛ぶ。

§

CalleeMember(*const Rc<str>, *const Expression)

[o] -> [o.name, o]

§

CalleeIndex

[o, k] -> [o[k], o]

§

CalleeValue

[f] -> [f, undefined]

§

Call(u32, *const Expression)

[f, this, a1..an] -> [r](式はエラーの文言用)。

§

CallList(*const Expression)

[f, this, list] -> [r]

§

New(u32)

[f, a1..an] -> [new f(...)]

§

NewList

[f, list] -> [new f(...list)]

§

ListNew

空の配列(引数の列・配列リテラル)を積む。

§

ListPush

[list, v] -> [list]

§

ListSpread

[list, iterable] -> [list](展開)

§

ObjNew

空のオブジェクト(オブジェクトリテラル)を積む。

§

ObjSpread

[o, src] -> [o](...src)

§

ObjProp(*const Property)

[o, (k), v] -> [o](通常のプロパティ。算出キーなら k もある)

§

ObjFunc(*const Property)

[o, (k)] -> [o](値が関数の定義のプロパティ・アクセサ。構文木のまま [[HomeObject]] のスコープで評価する)

§

ToStr

[v] -> [ToString(v)]

§

Template(*const Vec<String>)

テンプレートリテラル(quasis.len() - 1 個の文字列を取る)。

§

Hoist(*const [Statement], u8)

文の列の巻き上げ(0: hoist_declarations(None)、1: hoist_declarations(Some(&[])))。

§

PushBlock

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

§

PopScopes(u32)

スコープを n 段出る。

§

PushTdz(*const Pattern)

for-in/of の反復対象を評価するための TDZ のスコープに入る。

§

ForLetCopy

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

§

DeclVar(*const Pattern, u8, bool)

[v] ->: 宣言子 1 つ(var/let/const)。3 つ目は初期化子があるか。

§

Return

[v] ->: return v。

§

Throw

[v] ->: throw v。

§

JumpOut(u32)

ハンドラを通って飛ぶ(break/continue)。

§

EnterTry(u32, u32)

try の始まり(catch と finally の位置)。

§

LeaveTry

try または catch の正常な終わり(ハンドラを 1 つ外す)。

§

CatchBind(*const Pattern, bool)

catch の仮引数を束縛してスコープに入る(2 つ目は単純な識別子か)。

§

PushFinallyNormal

正常に finally へ入る(保留の完了 = 正常)。

§

EndFinally

finally の終わり: 保留していた完了(例外・return・break)を続ける。

§

SwitchScope(*const Vec<SwitchCase>)

switch のスコープ(レキシカル宣言がある場合)。

§

CaseEq(u32)

[d, tv]: 一致すれば d も取り除いて飛ぶ。でなければ [d]。

§

IterOpen(u8)

[obj] ->: 反復を始める(0: for-in、1: for-of、2: for-await)。

§

IterNext(u32)

次の要素を積む。終わりなら飛ぶ。

§

IterBindScope

let/const の for-in/of: 反復ごとの新しいスコープに入れ替える。

§

BindPattern(*const Pattern)

[v] ->: パターンへ束縛する(for-in/of の変数)。

§

IterEnd

反復を正常に終える(for-of の途中で溜めた例外があれば投げる)。

Auto Trait Implementations§

§

impl !RefUnwindSafe for GOp

§

impl !Send for GOp

§

impl !Sync for GOp

§

impl !UnwindSafe for GOp

§

impl Freeze for GOp

§

impl Unpin for GOp

§

impl UnsafeUnpin for GOp

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.