summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-21 14:47:54 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-21 14:47:54 +0000
commit6fac4c5f9f994a0eb95281e79b27a01bc4e6bf29 (patch)
tree6f1e9e05270dcbb19e81099398dde28d8f0d2b2c /ext
parenta5892c11485a36a89266bee7e3b2de5360bd53e6 (diff)
merges r23386 from trunk into ruby_1_9_1.
-- * 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/branches/ruby_1_9_1@23519 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 a2e6d40fbe..f0e1ca71ee 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -97,6 +97,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 aa7e0dd325..254e1921ce 100644
--- a/ext/dl/lib/dl/value.rb
+++ b/ext/dl/lib/dl/value.rb
@@ -61,6 +61,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