@@ -506,8 +506,6 @@ def run(conf = IRB.conf)
506506
507507 # Evaluates input for this session.
508508 def eval_input
509- exc = nil
510-
511509 @scanner . set_prompt do
512510 |ltype , indent , continue , line_no |
513511 if ltype
@@ -567,18 +565,18 @@ def eval_input
567565 is_assignment = assignment_expression? ( line )
568566 if IRB . conf [ :MEASURE ] && !IRB . conf [ :MEASURE_CALLBACKS ] . empty?
569567 result = nil
570- last_proc = proc { result = evaluate_line ( line , line_no , exception : exc ) }
568+ last_proc = proc { result = evaluate_line ( line , line_no ) }
571569 IRB . conf [ :MEASURE_CALLBACKS ] . inject ( last_proc ) { |chain , item |
572570 _name , callback , arg = item
573571 proc {
574- callback . ( @context , line , line_no , arg , exception : exc ) do
572+ callback . ( @context , line , line_no , arg ) do
575573 chain . call
576574 end
577575 }
578576 } . call
579577 @context . set_last_value ( result )
580578 else
581- evaluate_line ( line , line_no , exception : exc )
579+ evaluate_line ( line , line_no )
582580 end
583581 if @context . echo?
584582 if is_assignment
@@ -589,22 +587,17 @@ def eval_input
589587 output_value
590588 end
591589 end
592- rescue Interrupt => exc
593590 rescue SystemExit , SignalException
594591 raise
595- rescue Exception => exc
596- else
597- exc = nil
598- next
592+ rescue Interrupt , Exception => exc
593+ handle_exception ( exc )
594+ @context . workspace . local_variable_set ( :_ , exc )
599595 end
600- handle_exception ( exc )
601- @context . workspace . local_variable_set ( :_ , exc )
602- exc = nil
603596 end
604597 end
605598 end
606599
607- def evaluate_line ( line , line_no , exception : nil )
600+ def evaluate_line ( line , line_no )
608601 # Transform a non-identifier alias (@, $) or keywords (next, break)
609602 command , args = line . split ( /\s / , 2 )
610603 if original = @context . command_aliases [ command . to_sym ]
@@ -618,7 +611,7 @@ def evaluate_line(line, line_no, exception: nil)
618611 line = "#{ command } #{ command_class . transform_args ( args ) } "
619612 end
620613
621- @context . evaluate ( line , line_no , exception : exception )
614+ @context . evaluate ( line , line_no )
622615 end
623616
624617 def convert_invalid_byte_sequence ( str , enc )
0 commit comments