Struct Gs2Emitter

Source
pub struct Gs2Emitter { /* private fields */ }
Expand description

An emitter for the AST.

This emitter now builds up and returns a String for every AST node rather than writing to a shared output buffer.

Implementations§

Source§

impl Gs2Emitter

Source

pub fn new(context: EmitContext) -> Self

Creates a new Gs2Emitter with the given context.

Trait Implementations§

Source§

impl AstVisitor for Gs2Emitter

Source§

fn visit_node(&mut self, node: &AstKind) -> AstOutput

Visits an AST node.

Source§

fn visit_statement(&mut self, node: &StatementKind) -> AstOutput

Visits a statement node.

Source§

fn visit_assignment(&mut self, stmt_node: &P<AssignmentNode>) -> AstOutput

Visits an assignment node.

Source§

fn visit_virtual_branch(&mut self, node: &P<VirtualBranchNode>) -> Self::Output

Visits a virtual branch node.

Source§

fn visit_expr(&mut self, node: &ExprKind) -> AstOutput

Visits an expression node.

Source§

fn visit_array(&mut self, node: &ArrayKind) -> AstOutput

Visits an array node.

Source§

fn visit_array_node(&mut self, node: &P<ArrayNode>) -> AstOutput

Visits an array node.

Source§

fn visit_phi_array(&mut self, node: &P<PhiArrayNode>) -> AstOutput

Visits a phi array node.

Source§

fn visit_array_access(&mut self, node: &P<ArrayAccessNode>) -> AstOutput

Visits an array access node.

Source§

fn visit_bin_op(&mut self, node: &P<BinaryOperationNode>) -> AstOutput

Visits a binary operation node.

Source§

fn visit_unary_op(&mut self, node: &P<UnaryOperationNode>) -> AstOutput

Visits a unary operation node.

Source§

fn visit_identifier(&mut self, node: &P<IdentifierNode>) -> AstOutput

Visits an identifier node.

Source§

fn visit_literal(&mut self, node: &P<LiteralNode>) -> AstOutput

Visits a literal node.

Source§

fn visit_member_access(&mut self, node: &P<MemberAccessNode>) -> AstOutput

Visits a member access node.

Source§

fn visit_function_call(&mut self, node: &P<FunctionCallNode>) -> AstOutput

Visits a function call node.

Source§

fn visit_function(&mut self, node: &P<FunctionNode>) -> AstOutput

Visits a function node.

Source§

fn visit_return(&mut self, node: &P<ReturnNode>) -> AstOutput

Visits a return node.

Source§

fn visit_block(&mut self, node: &P<BlockNode>) -> AstOutput

Visits a block node.

Source§

fn visit_control_flow(&mut self, node: &P<ControlFlowNode>) -> AstOutput

Visits a control flow node.

Source§

fn visit_phi(&mut self, node: &P<PhiNode>) -> AstOutput

Visits a phi node.

Source§

fn visit_new(&mut self, node: &P<NewNode>) -> AstOutput

Visits a new node

Source§

fn visit_new_array(&mut self, node: &P<NewArrayNode>) -> AstOutput

Visits a new array node

Source§

fn visit_range(&mut self, node: &P<RangeNode>) -> AstOutput

Visits a range node

Source§

type Output = AstOutput

The output type of the visitor.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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