Code Review: Accessors

tfpt review /shelveset:Accessors;REDMOND\tomat

Fixes bug #20242: send attr_accessor.
Uses rule generators to implement attribute accessors. Previously both
used RubyMethodGroupInfo that was hacked to make them work. The hack is
not needed anymore.


I’m wondering why SetInstanceVariable() has the funny signature:

public static object SetInstanceVariable(object self, object value,
CodeContext/!/ context, SymbolId name) {

which is quite unlike other method signatures that we’re used to seeing.

Otherwise, looks good!

To optimize stack allocation. Maybe even better would be to take value
first. If the self or value argument is calculated as a result of
try-catch/try-finally block (something like @x = begin 1; rescue; end,
we need to save previous parameters to locals and enter the try-block
with an empty IL stack. The less parameters before the less allocated
variables on stack.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs