From c7809ca025b3b81dd6fb695f27bd5d0dfa3174af Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 10 Feb 2021 20:09:00 +0900 Subject: 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 --- mrbgems/mruby-catch/mrblib/catch.rb | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'mrbgems/mruby-catch/mrblib') 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 -- cgit v1.2.3