Lua.AST.Block (Lua v1.0.0-rc.1)

View Source

Represents a block of statements in Lua.

A block is a sequence of statements that execute in order. Blocks create a new scope for local variables.

Summary

Types

t()

@type t() :: %Lua.AST.Block{
  meta: Lua.AST.Meta.t() | nil,
  stmts: [Lua.AST.Statement.t()]
}

Functions

new(stmts \\ [], meta \\ nil)

@spec new([Lua.AST.Statement.t()], Lua.AST.Meta.t() | nil) :: t()

Creates a new Block.

Examples

iex> Lua.AST.Block.new([])
%Lua.AST.Block{stmts: [], meta: nil}

iex> Lua.AST.Block.new([], %Lua.AST.Meta{})
%Lua.AST.Block{stmts: [], meta: %Lua.AST.Meta{start: nil, end: nil, metadata: %{}}}