summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-10 02:36:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-10 02:36:13 +0000
commitf86b43b88c7ce541dbca55f3b6762766c45e4f10 (patch)
tree8088c8d46f770a838b406edb7078b90bdee6b37c /ext
parenta7e708b658641cfaca10715168e30d7b8af663d7 (diff)
downloadruby-f86b43b88c7ce541dbca55f3b6762766c45e4f10.tar.gz
ruby-f86b43b88c7ce541dbca55f3b6762766c45e4f10.tar.xz
ruby-f86b43b88c7ce541dbca55f3b6762766c45e4f10.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@23386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/dl/lib/dl/func.rb4
-rw-r--r--ext/dl/lib/dl/value.rb2
2 files changed, 6 insertions, 0 deletions
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
index 1ec34b7cf..7a8b62e32 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 bb8348cf5..56dfcefa3 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