diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-02-10 20:09:00 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-02-10 20:09:00 +0900 |
| commit | c7809ca025b3b81dd6fb695f27bd5d0dfa3174af (patch) | |
| tree | 4c605fa48cf54c5cd3ab0e08f6e779fa74d00034 /mrbgems/mruby-catch/mrblib/catch.rb | |
| parent | f0e25121fd66cf97e9c876ded43a419fa86532a9 (diff) | |
| download | mruby-c7809ca025b3b81dd6fb695f27bd5d0dfa3174af.tar.gz mruby-c7809ca025b3b81dd6fb695f27bd5d0dfa3174af.zip | |
Refactor `mruby-catch`; ref #5328
- Move `#catch` definition to `mruby-catch.c` to avoid tweaking
- Remove `#__preserve_catch_method`
- Implement whole `#throw` method in C
Diffstat (limited to 'mrbgems/mruby-catch/mrblib/catch.rb')
| -rw-r--r-- | mrbgems/mruby-catch/mrblib/catch.rb | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/mrbgems/mruby-catch/mrblib/catch.rb b/mrbgems/mruby-catch/mrblib/catch.rb index c69cd125e..8e5f59023 100644 --- a/mrbgems/mruby-catch/mrblib/catch.rb +++ b/mrbgems/mruby-catch/mrblib/catch.rb @@ -6,17 +6,3 @@ class UncaughtThrowError < ArgumentError super("uncaught throw #{tag.inspect}") end end - -module Kernel - def catch(tag=Object.new, &block) - # A double closure is required to make the nested `catch` distinguishable - # and because `break` goes back to `proc->upper`. - -> { -> { block.call(tag) }.call }.call - end - def throw(tag, val=nil) - __throw(tag, val) - raise UncaughtThrowError.new(tag, val) - end - - __preserve_catch_method -end |
