class Savi::AST::Yield

Overview

A Yield node indicates a kind of "intermediate return" where a function returns some yielded values back to the "yield block" of the caller, after which the caller can "continue" the yielding function back at the same place of execution where it was at that particular Yield. The result value of a Yield is the result value that was at the end of the "yield block" on the caller side, so this construct can also be used to get values back from the caller as well.

This is an internal AST type which has no corresponding source code syntax, because such a construct is only created inside macro expansions.

However, the most obvious example of use is in the yield macro.

Defined in:

savi/ast.cr

Constructors

Instance Method Summary

Instance methods inherited from class Savi::AST::Node

accept(ctx : Compiler::Context, visitor : Visitor)
accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor)
accept
, annotations : Array(Annotation) | Nil annotations, annotations=(annotations : Array(Annotation) | Nil) annotations=, children_accept(ctx : Compiler::Context, visitor : Visitor)
children_accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor)
children_accept
, from(other : Node) from, pos pos, pos? : Savi::Source::Pos? pos?, span_pos(source) span_pos, with_pos(pos : Source::Pos) with_pos

Constructor Detail

def self.new(terms : Array(Savi::AST::Node)) #

[View source]

Instance Method Detail

def children_accept(ctx : Compiler::Context, visitor : Visitor) #

[View source]
def children_accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor) #

[View source]
def name #

[View source]
def span_pos(source) #

[View source]
def terms : Array(Term) #

[View source]
def terms=(terms : Array(Term)) #

[View source]
def to_a : Array(A) #

[View source]