From ab142b727463329d29e10c6eba430858b52ef091 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 10 May 2009 02:36:13 +0000 Subject: * ext/dl/lib/dl/func.rb (DL::Function#bound?): returns if already bound to a block. * ext/dl/lib/dl/value.rb (DL::ValueUtil#wrap_arg): block must be given if arg is not bound. [ruby-dev:38404] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dl/lib/dl/func.rb | 4 ++++ ext/dl/lib/dl/value.rb | 2 ++ 2 files changed, 6 insertions(+) (limited to 'ext/dl/lib/dl') diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb index 1ec34b7cf3..7a8b62e325 100644 --- a/ext/dl/lib/dl/func.rb +++ b/ext/dl/lib/dl/func.rb @@ -95,6 +95,10 @@ module DL end end + def bound?() + @cfunc.ptr != 0 + end + def bind_at_call(&block) bind(&block) end diff --git a/ext/dl/lib/dl/value.rb b/ext/dl/lib/dl/value.rb index bb8348cf5e..56dfcefa32 100644 --- a/ext/dl/lib/dl/value.rb +++ b/ext/dl/lib/dl/value.rb @@ -63,6 +63,8 @@ module DL if( block ) arg.bind_at_call(&block) funcs.push(arg) + elsif !arg.bound? + raise(RuntimeError, "block must be given.") end return arg.to_i when String -- cgit v1.2.3