Class: CodeTools::Melbourne

Inherits:
Object
  • Object
show all
Defined in:
lib/rubinius/code/processor/processor.rb

Overview

TODO: This will change to: class Processor

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object

TODO: remove when all processors are defined



22
23
24
# File 'lib/rubinius/code/processor/processor.rb', line 22

def method_missing(sym, *args)
  puts "#{self.class}#method_missing: #{sym} #{args.map { |x| x.inspect}.join(", ")}"
end

Instance Method Details

#process_alias(line, to, from) ⇒ Object

Processing methods



29
30
31
# File 'lib/rubinius/code/processor/processor.rb', line 29

def process_alias(line, to, from)
  AST::Alias.new line, to, from
end

#process_and(line, left, right) ⇒ Object



33
34
35
# File 'lib/rubinius/code/processor/processor.rb', line 33

def process_and(line, left, right)
  AST::And.new line, left, right
end

#process_andattrasgn(line, receiver, name, arguments) ⇒ Object



37
38
39
# File 'lib/rubinius/code/processor/processor.rb', line 37

def process_andattrasgn(line, receiver, name, arguments)
  AST::AttributeAssignment.new line, receiver, name, arguments
end

#process_args(line, required, optional, splat, post, kwargs, kwrest, block) ⇒ Object



41
42
43
# File 'lib/rubinius/code/processor/processor.rb', line 41

def process_args(line, required, optional, splat, post, kwargs, kwrest, block)
  AST::Parameters.new line, required, optional, splat, post, kwargs, kwrest, block
end

#process_argscat(line, array, rest) ⇒ Object



45
46
47
# File 'lib/rubinius/code/processor/processor.rb', line 45

def process_argscat(line, array, rest)
  AST::ConcatArgs.new line, array, rest
end

#process_argspush(line, arguments, value) ⇒ Object



49
50
51
# File 'lib/rubinius/code/processor/processor.rb', line 49

def process_argspush(line, arguments, value)
  AST::PushArgs.new line, arguments, value
end

#process_array(line, array) ⇒ Object



53
54
55
# File 'lib/rubinius/code/processor/processor.rb', line 53

def process_array(line, array)
  AST::ArrayLiteral.new line, array
end

#process_attrasgn(line, receiver, name, arguments) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/rubinius/code/processor/processor.rb', line 57

def process_attrasgn(line, receiver, name, arguments)
  if name == :[]=
    AST::ElementAssignment.new line, receiver, arguments
  else
    AST::AttributeAssignment.new line, receiver, name, arguments
  end
end

#process_back_ref(line, ref) ⇒ Object



65
66
67
# File 'lib/rubinius/code/processor/processor.rb', line 65

def process_back_ref(line, ref)
  AST::BackRef.new line, ref
end

#process_begin(line, body) ⇒ Object



69
70
71
# File 'lib/rubinius/code/processor/processor.rb', line 69

def process_begin(line, body)
  AST::Begin.new line, body
end

#process_block(line, array) ⇒ Object



73
74
75
# File 'lib/rubinius/code/processor/processor.rb', line 73

def process_block(line, array)
  AST::Block.new line, array
end

#process_block_arg(line, name) ⇒ Object



77
78
79
# File 'lib/rubinius/code/processor/processor.rb', line 77

def process_block_arg(line, name)
  AST::BlockArgument.new line, name
end

#process_block_pass(line, arguments, body) ⇒ Object



81
82
83
# File 'lib/rubinius/code/processor/processor.rb', line 81

def process_block_pass(line, arguments, body)
  AST::BlockPass19.new line, arguments, body
end

#process_break(line, value) ⇒ Object



85
86
87
# File 'lib/rubinius/code/processor/processor.rb', line 85

def process_break(line, value)
  AST::Break.new line, value
end

#process_call(line, receiver, name, arguments) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/rubinius/code/processor/processor.rb', line 89

def process_call(line, receiver, name, arguments)
  if arguments.kind_of? AST::BlockPass
    block = arguments
    arguments = block.arguments
    block.arguments = nil
  else
    block = nil
  end

  if node = process_transforms(line, receiver, name, arguments)
    node.block = block if block
    return node
  end

  if arguments
    node = AST::SendWithArguments.new line, receiver, name, arguments
  else
    node = AST::Send.new line, receiver, name
  end

  node.block = block
  node
end

#process_case(line, receiver, whens, else_body) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/rubinius/code/processor/processor.rb', line 137

def process_case(line, receiver, whens, else_body)
  if receiver
    AST::ReceiverCase.new line, receiver, whens, else_body
  else
    AST::Case.new line, whens, else_body
  end
end

#process_cdecl(line, expr, value) ⇒ Object



145
146
147
# File 'lib/rubinius/code/processor/processor.rb', line 145

def process_cdecl(line, expr, value)
  AST::ConstantAssignment.new line, expr, value
end

#process_class(line, name, superclass, body) ⇒ Object



149
150
151
# File 'lib/rubinius/code/processor/processor.rb', line 149

def process_class(line, name, superclass, body)
  AST::Class.new line, name, superclass, body
end

#process_colon2(line, outer, name) ⇒ Object



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/rubinius/code/processor/processor.rb', line 153

def process_colon2(line, outer, name)
  if outer
    if outer.kind_of? AST::ConstantAccess and
       outer.name == :Rubinius
      case name
      when :Type
        AST::TypeConstant.new line
      when :Mirror
        AST::MirrorConstant.new line
      else
        AST::ScopedConstant.new line, outer, name
      end
    else
      AST::ScopedConstant.new line, outer, name
    end
  else
    AST::ConstantAccess.new line, name
  end
end

#process_colon3(line, name) ⇒ Object



173
174
175
# File 'lib/rubinius/code/processor/processor.rb', line 173

def process_colon3(line, name)
  AST::ToplevelConstant.new line, name
end

#process_const(line, name) ⇒ Object



177
178
179
# File 'lib/rubinius/code/processor/processor.rb', line 177

def process_const(line, name)
  AST::ConstantAccess.new line, name
end

#process_cvar(line, name) ⇒ Object



181
182
183
# File 'lib/rubinius/code/processor/processor.rb', line 181

def process_cvar(line, name)
  AST::ClassVariableAccess.new line, name
end

#process_cvasgn(line, name, value) ⇒ Object



185
186
187
# File 'lib/rubinius/code/processor/processor.rb', line 185

def process_cvasgn(line, name, value)
  AST::ClassVariableAssignment.new line, name, value
end

#process_cvdecl(line, name, value) ⇒ Object



189
190
191
# File 'lib/rubinius/code/processor/processor.rb', line 189

def process_cvdecl(line, name, value)
  AST::ClassVariableDeclaration.new line, name, value
end

#process_dangling_nodeObject



10
11
12
13
# File 'lib/rubinius/code/processor/processor.rb', line 10

def process_dangling_node
  puts "Processing called but node was NULL"
  # TODO: output info about the current AST node
end

#process_defined(line, expr) ⇒ Object



193
194
195
# File 'lib/rubinius/code/processor/processor.rb', line 193

def process_defined(line, expr)
  AST::Defined.new line, expr
end

#process_defn(line, name, body) ⇒ Object



197
198
199
# File 'lib/rubinius/code/processor/processor.rb', line 197

def process_defn(line, name, body)
  AST::Define.new line, name, body
end

#process_defs(line, receiver, name, body) ⇒ Object



201
202
203
# File 'lib/rubinius/code/processor/processor.rb', line 201

def process_defs(line, receiver, name, body)
  AST::DefineSingleton.new line, receiver, name, body
end

#process_dot2(line, start, finish) ⇒ Object



205
206
207
# File 'lib/rubinius/code/processor/processor.rb', line 205

def process_dot2(line, start, finish)
  AST::Range.new line, start, finish
end

#process_dot3(line, start, finish) ⇒ Object



209
210
211
# File 'lib/rubinius/code/processor/processor.rb', line 209

def process_dot3(line, start, finish)
  AST::RangeExclude.new line, start, finish
end

#process_dregx(line, str, array, flags) ⇒ Object



213
214
215
# File 'lib/rubinius/code/processor/processor.rb', line 213

def process_dregx(line, str, array, flags)
  AST::DynamicRegex.new line, str, array, flags
end

#process_dregx_once(line, str, array, flags) ⇒ Object



217
218
219
# File 'lib/rubinius/code/processor/processor.rb', line 217

def process_dregx_once(line, str, array, flags)
  AST::DynamicOnceRegex.new line, str, array, flags
end

#process_dstr(line, str, array) ⇒ Object



221
222
223
# File 'lib/rubinius/code/processor/processor.rb', line 221

def process_dstr(line, str, array)
  AST::DynamicString.new line, str, array
end

#process_dsym(line, str, array) ⇒ Object



225
226
227
# File 'lib/rubinius/code/processor/processor.rb', line 225

def process_dsym(line, str, array)
  AST::DynamicSymbol.new line, str, array
end

#process_dxstr(line, str, array) ⇒ Object



229
230
231
# File 'lib/rubinius/code/processor/processor.rb', line 229

def process_dxstr(line, str, array)
  AST::DynamicExecuteString.new line, str, array
end

#process_encoding(line, name) ⇒ Object



233
234
235
# File 'lib/rubinius/code/processor/processor.rb', line 233

def process_encoding(line, name)
  AST::Encoding.new line, name
end

#process_ensure(line, body, ensr) ⇒ Object



237
238
239
# File 'lib/rubinius/code/processor/processor.rb', line 237

def process_ensure(line, body, ensr)
  AST::Ensure.new line, body, ensr
end

#process_evstr(line, value) ⇒ Object



241
242
243
244
245
246
247
# File 'lib/rubinius/code/processor/processor.rb', line 241

def process_evstr(line, value)
  if value
    AST::ToString.new line, value
  else
    AST::StringLiteral.new line, ""
  end
end

#process_false(line) ⇒ Object



249
250
251
# File 'lib/rubinius/code/processor/processor.rb', line 249

def process_false(line)
  AST::FalseLiteral.new line
end

#process_fcall(line, name, arguments) ⇒ Object



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/rubinius/code/processor/processor.rb', line 253

def process_fcall(line, name, arguments)
  receiver = AST::Self.new line

  if arguments.kind_of? AST::BlockPass
    block = arguments
    arguments = block.arguments
    block.arguments = nil
  else
    block = nil
  end

  if node = process_transforms(line, receiver, name, arguments, true)
    node.block = block if block
    return node
  end

  if arguments
    node = AST::SendWithArguments.new line, receiver, name, arguments, true
  else
    node = AST::Send.new line, receiver, name, true
  end

  node.block = block
  node
end

#process_file(line) ⇒ Object



279
280
281
# File 'lib/rubinius/code/processor/processor.rb', line 279

def process_file(line)
  AST::File.new line
end

#process_fixnum(line, value) ⇒ Object



283
284
285
# File 'lib/rubinius/code/processor/processor.rb', line 283

def process_fixnum(line, value)
  AST::FixnumLiteral.new line, value
end

#process_flip2(line, start, finish) ⇒ Object



287
288
289
# File 'lib/rubinius/code/processor/processor.rb', line 287

def process_flip2(line, start, finish)
  AST::Flip2.new line, start, finish
end

#process_flip3(line, start, finish) ⇒ Object



291
292
293
# File 'lib/rubinius/code/processor/processor.rb', line 291

def process_flip3(line, start, finish)
  AST::Flip3.new line, start, finish
end

#process_float(line, str) ⇒ Object



295
296
297
# File 'lib/rubinius/code/processor/processor.rb', line 295

def process_float(line, str)
  AST::FloatLiteral.new line, str
end

#process_for(line, iter, arguments, body) ⇒ Object



299
300
301
302
303
# File 'lib/rubinius/code/processor/processor.rb', line 299

def process_for(line, iter, arguments, body)
  send = AST::Send.new line, iter, :each
  send.block = AST::For.new line, arguments, body
  send
end

#process_gasgn(line, name, expr) ⇒ Object



305
306
307
# File 'lib/rubinius/code/processor/processor.rb', line 305

def process_gasgn(line, name, expr)
  AST::GlobalVariableAssignment.new line, name, expr
end

#process_gvar(line, name) ⇒ Object



309
310
311
# File 'lib/rubinius/code/processor/processor.rb', line 309

def process_gvar(line, name)
  AST::GlobalVariableAccess.for_name line, name
end

#process_hash(line, array) ⇒ Object



313
314
315
# File 'lib/rubinius/code/processor/processor.rb', line 313

def process_hash(line, array)
  AST::HashLiteral.new line, array
end

#process_iasgn(line, name, value) ⇒ Object



317
318
319
# File 'lib/rubinius/code/processor/processor.rb', line 317

def process_iasgn(line, name, value)
  AST::InstanceVariableAssignment.new line, name, value
end

#process_if(line, cond, body, else_body) ⇒ Object



321
322
323
# File 'lib/rubinius/code/processor/processor.rb', line 321

def process_if(line, cond, body, else_body)
  AST::If.new line, cond, body, else_body
end

#process_imaginary(line, value) ⇒ Object



325
326
327
# File 'lib/rubinius/code/processor/processor.rb', line 325

def process_imaginary(line, value)
  AST::ImaginaryLiteral.new line, value
end

#process_iter(line, method_send, scope) ⇒ Object



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/rubinius/code/processor/processor.rb', line 329

def process_iter(line, method_send, scope)
  ary = scope && scope.array || []
  arguments = nil

  if ary.first.kind_of? AST::Parameters
    arguments = scope.array.shift
  end

  unless arguments
    arguments = AST::Parameters.new line
  end

  case ary.size
  when 0
    body = nil
  when 1
    if scope.locals
      body = scope
    else
      body = scope.array.shift
    end
  else
    body = scope
  end

  method_send.block = AST::Iter.new line, arguments, body
  method_send
end

#process_ivar(line, name) ⇒ Object



358
359
360
# File 'lib/rubinius/code/processor/processor.rb', line 358

def process_ivar(line, name)
  AST::InstanceVariableAccess.new line, name
end

#process_kw_arg(line, arguments) ⇒ Object



362
363
364
# File 'lib/rubinius/code/processor/processor.rb', line 362

def process_kw_arg(line, arguments)
  AST::Block.new line, arguments
end

#process_lambda(line, scope) ⇒ Object



366
367
368
369
370
371
372
373
374
375
# File 'lib/rubinius/code/processor/processor.rb', line 366

def process_lambda(line, scope)
  arguments = scope.array.shift
  if scope.array.size == 1
    body = scope.array.shift
  else
    body = scope
  end

  AST::Lambda.new line, arguments, body
end

#process_lasgn(line, name, value) ⇒ Object



378
379
380
# File 'lib/rubinius/code/processor/processor.rb', line 378

def process_lasgn(line, name, value)
  AST::LocalVariableAssignment.new line, name, value
end

#process_lit(line, sym) ⇒ Object



382
383
384
# File 'lib/rubinius/code/processor/processor.rb', line 382

def process_lit(line, sym)
  AST::SymbolLiteral.new line, sym
end

#process_lvar(line, name) ⇒ Object



386
387
388
# File 'lib/rubinius/code/processor/processor.rb', line 386

def process_lvar(line, name)
  AST::LocalVariableAccess.new line, name
end

#process_masgn(line, left, right, splat) ⇒ Object



390
391
392
# File 'lib/rubinius/code/processor/processor.rb', line 390

def process_masgn(line, left, right, splat)
  AST::MultipleAssignment.new line, left, right, splat
end

#process_match(line, pattern, flags) ⇒ Object



394
395
396
# File 'lib/rubinius/code/processor/processor.rb', line 394

def process_match(line, pattern, flags)
  AST::Match.new line, pattern, flags
end

#process_match2(line, pattern, value) ⇒ Object



398
399
400
# File 'lib/rubinius/code/processor/processor.rb', line 398

def process_match2(line, pattern, value)
  AST::Match2.new line, pattern, value
end

#process_match3(line, pattern, value) ⇒ Object



402
403
404
# File 'lib/rubinius/code/processor/processor.rb', line 402

def process_match3(line, pattern, value)
  AST::Match3.new line, pattern, value
end

#process_missing_node(line, node_name, node_type) ⇒ Object

This method is analogous to #method_missing. It is called if there is no processing method defined for a node.



17
18
19
# File 'lib/rubinius/code/processor/processor.rb', line 17

def process_missing_node(line, node_name, node_type)
  puts "Unhandled node #{node_name} (#{node_type})"
end

#process_module(line, name, body) ⇒ Object



406
407
408
# File 'lib/rubinius/code/processor/processor.rb', line 406

def process_module(line, name, body)
  AST::Module.new line, name, body
end

#process_negate(line, value) ⇒ Object



410
411
412
# File 'lib/rubinius/code/processor/processor.rb', line 410

def process_negate(line, value)
  AST::Negate.new line, value
end

#process_next(line, value) ⇒ Object



414
415
416
# File 'lib/rubinius/code/processor/processor.rb', line 414

def process_next(line, value)
  AST::Next.new line, value
end

#process_nil(line) ⇒ Object



418
419
420
# File 'lib/rubinius/code/processor/processor.rb', line 418

def process_nil(line)
  AST::NilLiteral.new line
end

#process_not(line, value) ⇒ Object



422
423
424
# File 'lib/rubinius/code/processor/processor.rb', line 422

def process_not(line, value)
  AST::Not.new line, value
end

#process_nth_ref(line, ref) ⇒ Object



426
427
428
# File 'lib/rubinius/code/processor/processor.rb', line 426

def process_nth_ref(line, ref)
  AST::NthRef.new line, ref
end

#process_number(line, value) ⇒ Object



430
431
432
433
434
435
436
437
# File 'lib/rubinius/code/processor/processor.rb', line 430

def process_number(line, value)
  case value
  when Fixnum
    AST::FixnumLiteral.new line, value
  when Bignum
    AST::NumberLiteral.new line, value
  end
end

#process_op_asgn1(line, receiver, index, op, value) ⇒ Object



439
440
441
# File 'lib/rubinius/code/processor/processor.rb', line 439

def process_op_asgn1(line, receiver, index, op, value)
  AST::OpAssignElement.new line, receiver, index, op, value
end

#process_op_asgn2(line, receiver, anddot, name, op, value) ⇒ Object



443
444
445
446
447
448
449
# File 'lib/rubinius/code/processor/processor.rb', line 443

def process_op_asgn2(line, receiver, anddot, name, op, value)
  if anddot
    AST::AndOpAssignAttribute.new line, receiver, name, op, value
  else
    AST::OpAssignAttribute.new line, receiver, name, op, value
  end
end

#process_op_asgn_and(line, var, value) ⇒ Object



451
452
453
# File 'lib/rubinius/code/processor/processor.rb', line 451

def process_op_asgn_and(line, var, value)
  AST::OpAssignAnd.new line, var, value
end

#process_op_asgn_or(line, var, value) ⇒ Object



455
456
457
# File 'lib/rubinius/code/processor/processor.rb', line 455

def process_op_asgn_or(line, var, value)
  AST::OpAssignOr.new line, var, value
end

#process_op_cdecl(line, var, value, op) ⇒ Object



459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/rubinius/code/processor/processor.rb', line 459

def process_op_cdecl(line, var, value, op)
  op_value = case op
  when :and
    AST::And.new line, var, value
  when :or
    AST::Or.new line, var, value
  else
    args = AST::ArrayLiteral.new line, [value]
    AST::SendWithArguments.new line, var, op, args
  end
  AST::ConstantAssignment.new line, var, op_value
end

#process_opt_arg(line, arguments) ⇒ Object



472
473
474
# File 'lib/rubinius/code/processor/processor.rb', line 472

def process_opt_arg(line, arguments)
  AST::Block.new line, arguments
end

#process_or(line, left, right) ⇒ Object



476
477
478
# File 'lib/rubinius/code/processor/processor.rb', line 476

def process_or(line, left, right)
  AST::Or.new line, left, right
end

#process_parse_error(message, column, line, source) ⇒ Object



5
6
7
8
# File 'lib/rubinius/code/processor/processor.rb', line 5

def process_parse_error(message, column, line, source)
  msg = "#{message}: #{@name}:#{line}:#{column}"
  @syntax_errors << SyntaxError.from(msg, column, line, source, @name)
end

#process_postarg(line, into, rest) ⇒ Object



480
481
482
# File 'lib/rubinius/code/processor/processor.rb', line 480

def process_postarg(line, into, rest)
  AST::PostArg.new line, into, rest
end

#process_postexe(line, body) ⇒ Object



484
485
486
487
488
# File 'lib/rubinius/code/processor/processor.rb', line 484

def process_postexe(line, body)
  node = AST::Send.new line, AST::Self.new(line), :at_exit, true
  node.block = AST::Iter.new line, nil, body
  node
end

#process_preexe(line, body) ⇒ Object



490
491
492
493
494
495
# File 'lib/rubinius/code/processor/processor.rb', line 490

def process_preexe(line, body)
  node = AST::PreExe19.new line
  node.block = AST::Iter.new line, nil, body
  add_pre_exe node
  node
end

#process_qcall(line, receiver, name, arguments) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/rubinius/code/processor/processor.rb', line 113

def process_qcall(line, receiver, name, arguments)
  if arguments.kind_of? AST::BlockPass
    block = arguments
    arguments = block.arguments
    block.arguments = nil
  else
    block = nil
  end

  if node = process_transforms(line, receiver, name, arguments)
    node.block = block if block
    return node
  end

  if arguments
    node = AST::AndSendWithArguments.new line, receiver, name, arguments
  else
    node = AST::AndSend.new line, receiver, name
  end

  node.block = block
  node
end

#process_rational(line, value) ⇒ Object



497
498
499
# File 'lib/rubinius/code/processor/processor.rb', line 497

def process_rational(line, value)
  AST::RationalLiteral.new line, value
end

#process_redo(line) ⇒ Object



501
502
503
# File 'lib/rubinius/code/processor/processor.rb', line 501

def process_redo(line)
  AST::Redo.new line
end

#process_regex(line, str, flags) ⇒ Object



505
506
507
# File 'lib/rubinius/code/processor/processor.rb', line 505

def process_regex(line, str, flags)
  AST::RegexLiteral.new line, str, flags
end

#process_resbody(line, conditions, body, nxt) ⇒ Object



509
510
511
# File 'lib/rubinius/code/processor/processor.rb', line 509

def process_resbody(line, conditions, body, nxt)
  AST::RescueCondition.new line, conditions, body, nxt
end

#process_rescue(line, body, rescue_body, else_body) ⇒ Object



513
514
515
# File 'lib/rubinius/code/processor/processor.rb', line 513

def process_rescue(line, body, rescue_body, else_body)
  AST::Rescue.new line, body, rescue_body, else_body
end

#process_retry(line) ⇒ Object



517
518
519
# File 'lib/rubinius/code/processor/processor.rb', line 517

def process_retry(line)
  AST::Retry.new line
end

#process_return(line, value) ⇒ Object



521
522
523
# File 'lib/rubinius/code/processor/processor.rb', line 521

def process_return(line, value)
  AST::Return.new line, value
end

#process_sclass(line, receiver, body) ⇒ Object



525
526
527
# File 'lib/rubinius/code/processor/processor.rb', line 525

def process_sclass(line, receiver, body)
  AST::SClass.new line, receiver, body
end

#process_scope(line, arguments, body, locals) ⇒ Object



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/rubinius/code/processor/processor.rb', line 529

def process_scope(line, arguments, body, locals)
  case body
  when AST::Begin
    if body.rescue.kind_of? AST::NilLiteral
      return nil unless arguments
    end
    body = AST::Block.new line, [body.rescue]
  when AST::Block
    ary = body.array
    if ary.size > 1 and
       ary.first.kind_of?(AST::Begin) and
       ary.first.rescue.kind_of?(AST::NilLiteral)
      ary.shift
    end
  when nil
    # Nothing
  else
    body = AST::Block.new line, [body]
  end

  if arguments and body
    body.array.unshift arguments
  end

  body.locals = locals if locals

  body
end

#process_self(line) ⇒ Object



558
559
560
# File 'lib/rubinius/code/processor/processor.rb', line 558

def process_self(line)
  AST::Self.new line
end

#process_splat(line, expr) ⇒ Object



562
563
564
# File 'lib/rubinius/code/processor/processor.rb', line 562

def process_splat(line, expr)
  AST::SplatValue.new line, expr
end

#process_str(line, str) ⇒ Object



566
567
568
# File 'lib/rubinius/code/processor/processor.rb', line 566

def process_str(line, str)
  AST::StringLiteral.new line, str
end

#process_super(line, arguments) ⇒ Object



570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/rubinius/code/processor/processor.rb', line 570

def process_super(line, arguments)
  if arguments.kind_of? AST::BlockPass
    block = arguments
    arguments = block.arguments
    block.arguments = nil
  else
    block = nil
  end

  node = AST::Super.new line, arguments
  node.block = block
  node
end

#process_svalue(line, expr) ⇒ Object



584
585
586
# File 'lib/rubinius/code/processor/processor.rb', line 584

def process_svalue(line, expr)
  AST::SValue.new line, expr
end

#process_to_ary(line, expr) ⇒ Object



588
589
590
# File 'lib/rubinius/code/processor/processor.rb', line 588

def process_to_ary(line, expr)
  AST::ToArray.new line, expr
end

#process_true(line) ⇒ Object



592
593
594
# File 'lib/rubinius/code/processor/processor.rb', line 592

def process_true(line)
  AST::TrueLiteral.new line
end

#process_undef(line, sym) ⇒ Object



596
597
598
# File 'lib/rubinius/code/processor/processor.rb', line 596

def process_undef(line, sym)
  AST::Undef.new line, sym
end

#process_until(line, cond, body, check_first) ⇒ Object



600
601
602
# File 'lib/rubinius/code/processor/processor.rb', line 600

def process_until(line, cond, body, check_first)
  AST::Until.new line, cond, body, check_first
end

#process_valias(line, to, from) ⇒ Object



614
615
616
# File 'lib/rubinius/code/processor/processor.rb', line 614

def process_valias(line, to, from)
  AST::VAlias.new line, to, from
end

#process_values(line, first, rest) ⇒ Object



618
619
620
621
# File 'lib/rubinius/code/processor/processor.rb', line 618

def process_values(line, first, rest)
  rest.body.unshift first
  rest
end

#process_vcall(line, name) ⇒ Object



604
605
606
607
608
609
610
611
612
# File 'lib/rubinius/code/processor/processor.rb', line 604

def process_vcall(line, name)
  receiver = AST::Self.new line

  if node = process_transforms(line, receiver, name, nil, true)
    return node
  end

  AST::Send.new line, receiver, name, true, true
end

#process_when(line, conditions, body) ⇒ Object



623
624
625
# File 'lib/rubinius/code/processor/processor.rb', line 623

def process_when(line, conditions, body)
  AST::When.new line, conditions, body
end

#process_while(line, cond, body, check_first) ⇒ Object



627
628
629
# File 'lib/rubinius/code/processor/processor.rb', line 627

def process_while(line, cond, body, check_first)
  AST::While.new line, cond, body, check_first
end

#process_xstr(line, str) ⇒ Object



631
632
633
# File 'lib/rubinius/code/processor/processor.rb', line 631

def process_xstr(line, str)
  AST::ExecuteString.new line, str
end

#process_yield(line, arguments, unwrap) ⇒ Object



635
636
637
# File 'lib/rubinius/code/processor/processor.rb', line 635

def process_yield(line, arguments, unwrap)
  AST::Yield.new line, arguments, unwrap
end

#process_zarray(line) ⇒ Object



639
640
641
# File 'lib/rubinius/code/processor/processor.rb', line 639

def process_zarray(line)
  AST::EmptyArray.new line
end

#process_zsuper(line) ⇒ Object



643
644
645
# File 'lib/rubinius/code/processor/processor.rb', line 643

def process_zsuper(line)
  AST::ZSuper.new line
end