Closed solson closed 12 years ago
Here I attempt to run a simple Kernel.eval(1):
Kernel.eval(1)
[..ricot/lib/apricot|master⚡]$ ../../bin/apricot -B -e '(. Kernel eval "1")' [1] 0000: push_cpath_top 0001: find_const 0 0003: push_literal "1" 0005: string_dup 0006: send_stack :eval, 1 0009: ret An exception occurred running ../../bin/apricot can't dup NilClass (TypeError) Backtrace: ImmediateValue(NilClass)#dup at kernel/common/immediate.rb:38 Kernel.eval at kernel/common/eval.rb:65 Object#__script__ (__top_level__) at -e:1 { } in Object#__script__ at ../../bin/apricot:54 Array#each at kernel/bootstrap/array.rb:68 Object#__script__ at ../../bin/apricot:50 Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:67 Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:109 Rubinius::Loader#script at kernel/loader.rb:632 Rubinius::Loader#main at kernel/loader.rb:835
Relevant code from kernel.rb (the second line is the failing dup):
dup
existing_scope = binding.constant_scope binding.constant_scope = existing_scope.dup
The binding.constant_scope seems to come from Rubinius::ConstantScope.of_sender (the sender in this case being an Apricot top-level block of code.)
binding.constant_scope
Rubinius::ConstantScope.of_sender
So it appears that this situation occurs because Apricot code has no ConstantScope.
Here I attempt to run a simple
Kernel.eval(1)
:Relevant code from kernel.rb (the second line is the failing
dup
):The
binding.constant_scope
seems to come fromRubinius::ConstantScope.of_sender
(the sender in this case being an Apricot top-level block of code.)So it appears that this situation occurs because Apricot code has no ConstantScope.