Skip to main content

Compiler

Struct Compiler 

Source
struct Compiler {
    ops: Vec<Op>,
    consts: Vec<Value>,
    names: Vec<Rc<str>>,
    slots: Vec<Slot>,
    prop_slots: Vec<PropSlot>,
    loops: Vec<LoopCtx>,
    pending_labels: Vec<Rc<str>>,
    block_depth: u32,
    try_depth: u32,
    iter_depth: u32,
    pending_exec: Vec<PendingExec>,
    exec_labels: Vec<Vec<ExecLabel>>,
}

Fields§

§ops: Vec<Op>§consts: Vec<Value>§names: Vec<Rc<str>>§slots: Vec<Slot>§prop_slots: Vec<PropSlot>§loops: Vec<LoopCtx>§pending_labels: Vec<Rc<str>>

直後のループまたはブロックに引き継ぐラベル一覧。

§block_depth: u32

現在の字句ブロックスコープの入れ子段数。

§try_depth: u32

現在の try ブロックの入れ子段数。

§iter_depth: u32

現在の for-in / for-of イテレータ(1段につき vm_stack 2要素)の入れ子段数。

§pending_exec: Vec<PendingExec>

実行時に囲むループの飛び先を持つ Exec。

§exec_labels: Vec<Vec<ExecLabel>>

Exec ごとの、外側のラベル付きループ/ブロックへの飛び先の表。

Implementations§

Source§

impl Compiler

Source

fn name(&mut self, n: &Rc<str>) -> u32

Source

fn slot(&mut self) -> u32

Source

fn prop_slot(&mut self) -> u32

Source

fn load(&mut self, n: &Rc<str>)

Source

fn constant(&mut self, v: Value)

Source

fn emit_jump(&mut self, op: Op) -> usize

飛び先が未定の命令を置く。

Source

fn patch(&mut self, at: usize)

Source

fn patch_to(&mut self, at: usize, to: u32)

Source

fn emit_call_args( &mut self, arguments: &[Expression], orig_callee: *const Expression, )

Source

fn compile_chain(&mut self, e: &Expression) -> bool

Source

fn expr(&mut self, e: &Expression)

Source

fn exec_fallback(&mut self, s: &Statement)

Source

fn emit_unwind_to_loop(&mut self, target_idx: usize)

Source

fn stmt(&mut self, s: &Statement)

Source

fn close_loop(&mut self, cont: u32)

ループ(または switch)の出口はここ。continue は cont へ。

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> 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.