Class: Rubinius::ToolSet.current::TS::Melbourne19
- Inherits:
-
Melbourne
- Object
- Melbourne
- Rubinius::ToolSet.current::TS::Melbourne19
show all
- Defined in:
- lib/rubinius/processor/processor.rb
Instance Method Summary
collapse
-
#process_args(line, required, optional, splat, post, block) ⇒ Object
-
#process_block_pass(line, arguments, body) ⇒ Object
-
#process_encoding(line, name) ⇒ Object
-
#process_for(line, iter, arguments, body) ⇒ Object
-
#process_iter(line, method_send, scope) ⇒ Object
-
#process_lambda(line, scope) ⇒ Object
-
#process_number(line, value) ⇒ Object
-
#process_op_asgn_or(line, var, value) ⇒ Object
-
#process_opt_arg(line, arguments) ⇒ Object
-
#process_postarg(line, into, rest) ⇒ Object
-
#process_postexe(line, body) ⇒ Object
-
#process_preexe(line, body) ⇒ Object
-
#process_scope(line, arguments, body, locals) ⇒ Object
-
#process_super(line, arguments) ⇒ Object
Methods inherited from Melbourne
#method_missing, #process_alias, #process_and, #process_argscat, #process_argspush, #process_array, #process_attrasgn, #process_back_ref, #process_begin, #process_block, #process_block_arg, #process_break, #process_call, #process_case, #process_cdecl, #process_class, #process_colon2, #process_colon3, #process_const, #process_cvar, #process_cvasgn, #process_cvdecl, #process_dangling_node, #process_defined, #process_defn, #process_defs, #process_dot2, #process_dot3, #process_dregx, #process_dregx_once, #process_dstr, #process_dsym, #process_dxstr, #process_ensure, #process_evstr, #process_false, #process_fcall, #process_file, #process_fixnum, #process_flip2, #process_flip3, #process_float, #process_gasgn, #process_gvar, #process_hash, #process_iasgn, #process_if, #process_ivar, #process_lasgn, #process_lit, #process_lvar, #process_masgn, #process_match, #process_match2, #process_match3, #process_missing_node, #process_module, #process_negate, #process_next, #process_nil, #process_not, #process_nth_ref, #process_op_asgn1, #process_op_asgn2, #process_op_asgn_and, #process_or, #process_parse_error, #process_redo, #process_regex, #process_resbody, #process_rescue, #process_retry, #process_return, #process_sclass, #process_self, #process_splat, #process_str, #process_svalue, #process_to_ary, #process_true, #process_undef, #process_until, #process_valias, #process_values, #process_vcall, #process_when, #process_while, #process_xstr, #process_yield, #process_zarray, #process_zsuper
Instance Method Details
#process_args(line, required, optional, splat, post, block) ⇒ Object
518
519
520
|
# File 'lib/rubinius/processor/processor.rb', line 518
def process_args(line, required, optional, splat, post, block)
AST::FormalArguments19.new line, required, optional, splat, post, block
end
|
#process_block_pass(line, arguments, body) ⇒ Object
522
523
524
|
# File 'lib/rubinius/processor/processor.rb', line 522
def process_block_pass(line, arguments, body)
AST::BlockPass19.new line, arguments, body
end
|
#process_encoding(line, name) ⇒ Object
526
527
528
|
# File 'lib/rubinius/processor/processor.rb', line 526
def process_encoding(line, name)
AST::Encoding.new line, name
end
|
#process_for(line, iter, arguments, body) ⇒ Object
563
564
565
566
567
|
# File 'lib/rubinius/processor/processor.rb', line 563
def process_for(line, iter, arguments, body)
send = AST::Send.new line, iter, :each
send.block = AST::For19.new line, arguments, body
send
end
|
#process_iter(line, method_send, scope) ⇒ Object
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
|
# File 'lib/rubinius/processor/processor.rb', line 534
def process_iter(line, method_send, scope)
ary = scope && scope.array || []
arguments = nil
if ary.first.kind_of? AST::FormalArguments
arguments = scope.array.shift
end
unless arguments
arguments = AST::FormalArguments19.new line, nil, nil, nil, nil, nil
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::Iter19.new line, arguments, body
method_send
end
|
#process_lambda(line, scope) ⇒ Object
569
570
571
572
573
574
575
576
577
578
579
580
581
582
|
# File 'lib/rubinius/processor/processor.rb', line 569
def process_lambda(line, scope)
arguments = scope.array.shift
if scope.array.size == 1
body = scope.array.shift
else
body = scope
end
receiver = AST::Self.new line
method_send = AST::Send.new line, receiver, :lambda, true
method_send.block = AST::Iter19.new line, arguments, body
method_send
end
|
#process_number(line, value) ⇒ Object
584
585
586
587
588
589
590
591
|
# File 'lib/rubinius/processor/processor.rb', line 584
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_asgn_or(line, var, value) ⇒ Object
593
594
595
|
# File 'lib/rubinius/processor/processor.rb', line 593
def process_op_asgn_or(line, var, value)
AST::OpAssignOr19.new line, var, value
end
|
#process_opt_arg(line, arguments) ⇒ Object
597
598
599
|
# File 'lib/rubinius/processor/processor.rb', line 597
def process_opt_arg(line, arguments)
AST::Block.new line, arguments
end
|
#process_postarg(line, into, rest) ⇒ Object
530
531
532
|
# File 'lib/rubinius/processor/processor.rb', line 530
def process_postarg(line, into, rest)
AST::PostArg.new line, into, rest
end
|
#process_postexe(line, body) ⇒ Object
601
602
603
604
605
|
# File 'lib/rubinius/processor/processor.rb', line 601
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
607
608
609
610
611
612
|
# File 'lib/rubinius/processor/processor.rb', line 607
def process_preexe(line, body)
node = AST::PreExe19.new line
node.block = AST::Iter19.new line, nil, body
add_pre_exe node
node
end
|
#process_scope(line, arguments, body, locals) ⇒ Object
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
|
# File 'lib/rubinius/processor/processor.rb', line 614
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
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_super(line, arguments) ⇒ Object
643
644
645
646
647
648
649
650
651
652
653
654
655
|
# File 'lib/rubinius/processor/processor.rb', line 643
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
|