define_method is not setting captured variables as parameters in 1.8 mode
-------------------------------------------------------------------------

                 Key: JRUBY-5379
                 URL: http://jira.codehaus.org/browse/JRUBY-5379
             Project: JRuby
          Issue Type: Bug
          Components: Compiler, Interpreter
    Affects Versions: JRuby 1.6RC1
            Reporter: Thomas E Enebo
            Assignee: Thomas E Enebo


{noformat}
class Base
  def meth(a, b)
  end
end

class Derived < Base
  d = 1
  define_method(:meth) do |a, d|
    puts "d before super #{d}"
    super
  end

  define_method(:check) do
    puts d
  end
end

e = Derived.new
e.check
e.meth(1, 2)
e.check
{noformat}

In this snippet we should print 1, d before super 2, 2 but we print 1, d before 
super 2, 1.  We are not actually setting the captured value.  1.9 mode does not 
allow captured variables as parms so we this is only a 1.8 issue.   
Interestingly enough the solution for JRUBY-5303 will resolve this since the 
plan for that bug is to have StaticScope hold parameter locations (location is 
index+depth combo) in an array.  {g,s}ArgValue* on Dynamic scope will assign 
based on those locations.  Magically, it should just work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to