diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-30 07:41:23 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-30 07:41:23 +0000 |
commit | 287810940070b1c7b0cc915e6728da2f0aaac5e2 (patch) | |
tree | fd7394d6274c72eb3a15a179c627143bf8fb707f /lib | |
parent | b6e85a5e29a9790ec33add32bb554b55e3ad4ba9 (diff) |
new exception model
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/debug.rb | 7 | ||||
-rw-r--r-- | lib/delegate.rb | 2 | ||||
-rw-r--r-- | lib/tk.rb | 21 |
3 files changed, 22 insertions, 8 deletions
diff --git a/lib/debug.rb b/lib/debug.rb index 432c7b4d19..2e3a29aa9e 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -11,6 +11,8 @@ class DEBUGGER__ @scripts = {} end + DEBUG_LAST_CMD = [] + def interrupt @stop_next = 1 end @@ -40,6 +42,11 @@ class DEBUGGER__ STDOUT.flush while input = STDIN.gets input.chop! + if input == "" + input = DEBUG_LAST_CMD[0] + else + DEBUG_LAST_CMD[0] = input + end case input when /^b(reak)?\s+(([^:\n]+:)?.+)/ pos = $2 diff --git a/lib/delegate.rb b/lib/delegate.rb index c73a3bd8a0..bc6f876212 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -7,7 +7,7 @@ # # Usage: # foo = Object.new -# foo = SimpleDelegator.new(foo) +# foo2 = SimpleDelegator.new(foo) # foo.hash == foo2.hash # => true class Delegator @@ -113,7 +113,6 @@ module TkComm end end def list(val) - p val tk_split_list(val).to_a end def window(val) @@ -274,7 +273,7 @@ module TkCore end def _get_eval_string(str) - return str if str == None + return nil if str == None if str.kind_of?(Hash) str = hash_kv(str).join(" ") elsif str == nil @@ -294,10 +293,20 @@ module TkCore def tk_call(*args) print args.join(" "), "\n" if $DEBUG args.filter {|x|_get_eval_string(x)} - args.delete!(None) - args.flatten! args.compact! - res = INTERP._invoke(*args) + args.flatten! + begin + res = INTERP._invoke(*args) + rescue NameError + err = $! + begin + args.unshift "unknown" + res = INTERP._invoke(*args) + rescue + raise unless /^invalid command/ =~ $! + raise err + end + end if INTERP._return_value() != 0 fail RuntimeError, res, error_at end @@ -819,8 +828,6 @@ class TkObject<TkKernel if (args.length == 1) configure id.id2name, args[0] else - p caller - p id.id2name $@ = error_at super end |