Projects

Ticket #812 (new defect)

Opened 19 months ago

Last modified 16 months ago

Eval with binding is not able to retrieve local_variables

Reported by: eloy.de.enige@… Owned by: lsansonetti@…
Priority: blocker Milestone:
Component: MacRuby Keywords: irb
Cc:

Description

$ cat t.rb
toplevel = :ok
p local_variables
p eval('local_variables', TOPLEVEL_BINDING)

b = Object.new.instance_eval { binding }
p b
eval('not_toplevel = :ok', b)
p eval('local_variables', b)

$ ruby19 t.rb
[:toplevel, :b]
[:toplevel, :b]
#<Binding:0x00000100864bf0>
[:not_toplevel, :toplevel, :b]

$ macruby t.rb
[:toplevel, :b]
[]
#<Binding:0x2000c5ea0>
[]

This is needed by dietrb in order to complete lvars or methods on a lvar.

Change History

Changed 19 months ago by eloy.de.enige@…

FYI: There are specs inthe MacRuby repo in ./spec/dietrb/ext/completion_spec.rb which show the problem.

Changed 16 months ago by lsansonetti@…

I committed some fixes as r4789. However, one of the tests in the script pasted above doesn't run successfully yet.

$ ./miniruby t3.rb 
[:toplevel, :b]
[]
#<Binding:0x4004c5020>
[:toplevel, :b, :not_toplevel]
$
Note: See TracTickets for help on using tickets.