Class: Loxxy::Ast::LoxBlockStmt

Inherits:
LoxCompoundExpr show all
Defined in:
lib/loxxy/ast/lox_block_stmt.rb

Instance Attribute Summary

Attributes inherited from LoxCompoundExpr

#subnodes

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxNode

#done!

Constructor Details

#initialize(aPosition, decls) ⇒ LoxBlockStmt

Returns a new instance of LoxBlockStmt.

Parameters:

  • aPosition (Rley::Lexical::Position)

    Position of the entry in the input stream.

  • decls (Loxxy::Ast::LoxSeqDecl)


10
11
12
# File 'lib/loxxy/ast/lox_block_stmt.rb', line 10

def initialize(aPosition, decls)
  super(aPosition, [decls])
end

Instance Method Details

#accept(visitor) ⇒ Object

Part of the 'visitee' role in Visitor design pattern.

Parameters:



20
21
22
# File 'lib/loxxy/ast/lox_block_stmt.rb', line 20

def accept(visitor)
  visitor.visit_block_stmt(self)
end

#empty?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/loxxy/ast/lox_block_stmt.rb', line 14

def empty?
  subnodes.size == 1 && subnodes[0].nil?
end