pub struct BlockState {
    pub values: HashMap<ValueName, Value>,
    pub inner_values_name: HashSet<InnerValueName>,
    pub labels: HashSet<LabelName>,
    pub last_register_number: u64,
    pub manual_return: bool,
    pub parent: Option<Rc<RefCell<BlockState>>>,
    pub children: Vec<Rc<RefCell<BlockState>>>,
    pub context: SemanticStack,
}
Expand description

Block state

  • values - contains unique values map for current state but not unique for parent states. The map contains key-value: value_name (unique only for current state); and Value itself - value parameters.
  • inner_values_name - is entity that represent inner value name - it can be different from Value name because it should be unique for all parent states. For example, of 3 values with name x, inner value name will be: [x, x.0, x.1]. It mean, inner value name can contain value counter as end of the name.
  • labels - labels set, for conditional operation. Unique for current and all paren states.
  • last_register_number - represent register counter for current and all parent states for Codegen. Register represented as u64 and should be linearly incremented.
  • manual_return - flag indicated, that return was invoked from other state, for example: if-flow, loop-flow
  • parent - represent parent states.

Fields§

§values: HashMap<ValueName, Value>

State values

§inner_values_name: HashSet<InnerValueName>

Used to keep all names in the block state (and parent) as unique

§labels: HashSet<LabelName>

State labels for conditional operations

§last_register_number: u64

Last register for unique register representation

§manual_return: bool

Manual return from other states

§parent: Option<Rc<RefCell<BlockState>>>

Parent state

§children: Vec<Rc<RefCell<BlockState>>>

children states

§context: SemanticStack

Semantic stack context for Block state

Implementations§

source§

impl BlockState

source

pub fn new(parent: Option<Rc<RefCell<Self>>>) -> Self

Init block state with optional parent state

Trait Implementations§

source§

impl Debug for BlockState

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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.