Class: Y2R::AST::YCP::FileBlock

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



1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
# File 'lib/y2r/ast/ycp.rb', line 1219

def compile(context)
  class_statements = []

  context.inside self do |inner_context|
    class_statements += build_main_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::Class.new(
            :name       => class_name,
            :superclass => Ruby::Variable.new(:name => "Client"),
            :statements => Ruby::Statements.new(
              :statements => class_statements
            )
          )
        ),
        Ruby::MethodCall.new(
          :receiver       => Ruby::MethodCall.new(
            :receiver => Ruby::ConstAccess.new(
              :receiver => Ruby::Variable.new(:name => "Yast"),
              :name     => class_name
            ),
            :name     => "new",
            :args     => [],
            :block    => nil,
            :parens   => true
          ),
          :name           => "main",
          :args           => [],
          :block          => nil,
          :parens         => true,
          :comment_before => ""
        )
      ]
    )
  )
end

#nameObject



1215
1216
1217
# File 'lib/y2r/ast/ycp.rb', line 1215

def name
  nil
end