Class: Y2R::AST::YCP::IncludeBlock

Inherits:
Node
  • Object
show all
Defined in:
lib/y2r/ast/ycp.rb

Instance Method Summary collapse

Methods inherited from Node

#always_returns?, #compile_as_copy_if_needed, #compile_statements, #compile_statements_inside_block, #compile_statements_with_whitespace, #creates_local_scope?, #needs_copy?, #never_nil?, #optimize_last_statement, #optimize_next, #optimize_return, #remove_duplicate_imports, transfers_comments

Instance Method Details

#compile(context) ⇒ Object



1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
# File 'lib/y2r/ast/ycp.rb', line 1457

def compile(context)
  class_statements = []

  context.inside self do |inner_context|
    class_statements += build_initialize_method_def(inner_context)
    class_statements += build_other_defs(inner_context)
  end

  Ruby::Program.new(
    :statements => Ruby::Statements.new(
      :statements => [
        Ruby::Module.new(
          :name       => "Yast",
          :statements => Ruby::Module.new(
            :name       => module_name,
            :statements => Ruby::Statements.new(
              :statements => class_statements
            )
          )
        )
      ]
    )
  )
end