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 の途中で溜めた例外があれば投げる)。