berkesokhan / rubydotnetcompiler

Automatically exported from code.google.com/p/rubydotnetcompiler
1 stars 0 forks source link

Attempt to access top level variable raises NoMethodError instead of NameError #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
## Adapted from IronRuby tests (Runtime\Class\test_top_level.rb)

foo = 1

def bar
    foo
end

begin
    puts bar
rescue Exception => obj
    puts obj.class
end

Expected output:
NameError

Actual output:
NoMethodError

Original issue reported on code.google.com by meaningi...@gmail.com on 4 Oct 2007 at 3:04

GoogleCodeExporter commented 9 years ago

Original comment by meaningi...@gmail.com on 23 Oct 2007 at 2:33

GoogleCodeExporter commented 9 years ago
This fix breaks if it's really a method call instead of variable access.

Test case:

  begin
    foo
  rescue NameError
    puts 'ok'
  rescue
    puts 'not ok'
  end

  begin
    foo()
  rescue NoMethodError
    puts 'ok'
  rescue
    puts 'not ok'
  end

Original comment by sason...@gmail.com on 25 Oct 2007 at 7:21

GoogleCodeExporter commented 9 years ago
Should be fixed now

Original comment by meaningi...@gmail.com on 1 Nov 2007 at 5:58