Skip to content
  • Luke Gruber's avatar
    d592ddd5
    Fix compile issue with a short-circuited if/unless condition and `defined?` · d592ddd5
    Luke Gruber authored
    This caused an issue when `defined?` was in the `if` condition. Its
    instructions weren't appended to the instruction sequence even though it was compiled
    if a compile-time known logical short-circuit happened before the `defined?`. The catch table
    entry (`defined?` compilation produces a catch table entry) was still on the iseq even though the
    instructions weren't there. This caused faulty exception handling in the method.
    The solution is to no add the catch table entry for `defined?` after a compile-time known logical
    short circuit.
    
    This shouldn't touch much code, it's only for cases like the following,
    which can occur during debugging:
    
        if false && defined?(Some::CONSTANT)
        "more code..."
        end
    
    Fixes [Bug #20501]
    d592ddd5
    Fix compile issue with a short-circuited if/unless condition and `defined?`
    Luke Gruber authored
    This caused an issue when `defined?` was in the `if` condition. Its
    instructions weren't appended to the instruction sequence even though it was compiled
    if a compile-time known logical short-circuit happened before the `defined?`. The catch table
    entry (`defined?` compilation produces a catch table entry) was still on the iseq even though the
    instructions weren't there. This caused faulty exception handling in the method.
    The solution is to no add the catch table entry for `defined?` after a compile-time known logical
    short circuit.
    
    This shouldn't touch much code, it's only for cases like the following,
    which can occur during debugging:
    
        if false && defined?(Some::CONSTANT)
        "more code..."
        end
    
    Fixes [Bug #20501]
Loading