Skip to content
  • Jeremy Evans's avatar
    13cd9635
    Prevent modification of splat array inside setup_parameters_complex · 13cd9635
    Jeremy Evans authored
    For the following:
    
    ```
    def f(*a); a end
    p f(*a, kw: 3)
    ```
    
    `setup_parameters_complex` pushes `{kw: 3}` onto `a`.  This worked fine
    back when `concatarray true` was used and `a` was already a copy. It
    does not work correctly with the optimization to switch to
    `concatarray false`.  This duplicates the array on the callee side
    in such a case.
    
    This affects cases when passing a regular splat and a keyword splat
    (or literal keywords) in a method call, where the method does not
    accept keywords.
    
    This allocation could probably be avoided, but doing so would
    make `setup_parameters_complex` more complicated.
    13cd9635
    Prevent modification of splat array inside setup_parameters_complex
    Jeremy Evans authored
    For the following:
    
    ```
    def f(*a); a end
    p f(*a, kw: 3)
    ```
    
    `setup_parameters_complex` pushes `{kw: 3}` onto `a`.  This worked fine
    back when `concatarray true` was used and `a` was already a copy. It
    does not work correctly with the optimization to switch to
    `concatarray false`.  This duplicates the array on the callee side
    in such a case.
    
    This affects cases when passing a regular splat and a keyword splat
    (or literal keywords) in a method call, where the method does not
    accept keywords.
    
    This allocation could probably be avoided, but doing so would
    make `setup_parameters_complex` more complicated.
Loading