use backend::*; use error::Error; use module::TranslationContext; use wasmparser::{FunctionBody, Operator, Type}; // TODO: Use own declared `Type` enum. /// Type of a control frame. #[derive(Debug, Copy, Clone, PartialEq)] enum ControlFrameKind { /// A regular block frame. /// /// Can be used for an implicit function block. Block { end_label: Label }, /// Loop frame (branching to the beginning of block). Loop { header: Label }, /// True-subblock of if expression. IfTrue { /// If jump happens inside the if-true block then control will /// land on this label. end_label: Label, /// If the condition of the `if` statement is unsatisfied, control /// will land on this label. This label might point to `else` block if it /// exists. Otherwise it equal to `end_label`. if_not: Label, }, /// False-subblock of if expression. IfFalse { end_label: Label }, } impl ControlFrameKind { /// Returns a label which should be used as a branch destination. fn block_end(&self) -> Option