Code Review: miscrubyfixes


#1

tfpt review “/shelveset:miscrubyfixes;REDMOND\tomat”
Comment :
Implements range conditions:

  • If a range whose bounds are not integer literals is used as a 
    

control flow condition (if/unless/while-loop/until-loop/?:slight_smile: it is
considered a ‘range condition’. It returns true/false depending on
whether the execution state is in the range or not (the state is
maintained in a local variable).

  • Adjusts ParseTree to return flip2, flip3 nodes for range 
    

conditions.

  • Removes compile time checks of range bounds - they should be 
    

evaluated at runtime.

Implements regex conditions: A regex in a condition should perform
match against $_.
Converts a call to =~ method to MatchExpression if the left hand side
is a regex expression (MRI doesn’t call =~ method in that case).

Stops using dynamic sites for Proc#call, we can easily use block
dispatchers.

Fixes bugs:

  • def f; yield; end;   f {|a,b,*c| p [a,b,c] }
    
  • proc{|x,| x}.call([1]).should == [1] ... This is actually 
    

inconsistent with yield in MRI. We had it consistent :-/.

  • [ ironruby-Bugs-21258 ] Can't splat to unwrap an array of 
    

exceptions.

  • Symbol#inspect should quote only symbols that are not valid 
    

variable/method/operator names.

  •             Fixes 'defined?' for qualified constants and 
    

methods.

Tomas


#2

Looks good.