class

Ameba::AST::FlowExpression

Inherits Ameba::AST::Util < Reference < Object

Represents a flow expression in Crystal code. For example:

def foobar
  a = 3
  return 42 # => flow expression
  a + 1
end

Flow expression contains an actual node of a control expression and a parent node, which allows easily search through the related statement (i.e. find unreachable code)

Constructors

new(node : Crystal::ASTNode, in_loop : Bool)

Creates a new flow expression.

FlowExpression.new(node, parent_node)
Source

Instance methods

end_location(*args, **options)
Source
end_location(*args, **options, &)
Source
in_loop?

Is true only if some of the nodes parents is a loop.

Source
location(*args, **options)
Source
location(*args, **options, &)
Source
node

The actual node of the flow expression.

Source
to_s(*args, **options)
Source
to_s(*args, **options, &)
Source
unreachable_nodes

Returns nodes which can't be reached because of a flow command inside. For example:

def foobar
  a = 3
  return 42
  a + 1 # => unreachable node
end
Source