HomePhorge

(PUP-3978) Ruby 1.8.x uglifications
d965333b5373Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(PUP-3978) Ruby 1.8.x uglifications

A Proc is not passed by reference in Ruby 1.8.x. Instead a new Proc
is created for every call. This means that the closure is lost
and with it, the arity and parameters that makes it possible to
derive the correct Callable type.

This commit rectifies this by creating a block with an arity that
matches the closure. The mapping will be correct up to 10 parameters.
closures with more parameters than 10 will be mapped as varargs.

This fix means that one mistake may go undetected when using Ruby
1.8.x and that is when a function declares the block to take N
parameters and the actual call to that block is passing fewer values.
Ruby will automatically assing nil values to the remaining args
and the preconfigured block will then pass the correct number of
parameters, albeit with nil values for some of them, to the closure
call method which then will consider the call OK with respect to
number of provided parameter values.

Details

Provenance
Thomas Hallgren <thomas@tada.se>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU94fc4d242711: (PUP-3978) In response to PR review comments
Branches
Unknown
Tags
Unknown

Event Timeline

Thomas Hallgren <thomas@tada.se> committed rPUd965333b5373: (PUP-3978) Ruby 1.8.x uglifications (authored by Thomas Hallgren <thomas@tada.se>).Feb 10 2015, 10:26 PM