mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
bugfix for [ruby-talk:121309].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f7a5ee56d7
commit
f7884c6beb
3 changed files with 21 additions and 13 deletions
|
@ -71,6 +71,9 @@ module DL
|
|||
init_sym()
|
||||
|
||||
rty,renc,rdec,_,_,_ = @types.encode_type(ret)
|
||||
if( !rty )
|
||||
raise(TypeError, "unsupported type: #{ret}")
|
||||
end
|
||||
ty,enc,dec = encode_types(args)
|
||||
symty = rty + ty
|
||||
|
||||
|
@ -132,6 +135,9 @@ module DL
|
|||
init_sym()
|
||||
|
||||
rty,_,rdec,_,_,_ = @types.encode_type(rettype)
|
||||
if( !rty )
|
||||
raise(TypeError, "unsupported type: #{rettype}")
|
||||
end
|
||||
ty,enc,dec = encode_types(argtypes)
|
||||
symty = rty + ty
|
||||
|
||||
|
@ -185,6 +191,9 @@ module DL
|
|||
dec = nil
|
||||
tys.each_with_index{|ty,idx|
|
||||
ty,c1,c2,_,_,_ = @types.encode_type(ty)
|
||||
if( !ty )
|
||||
raise(TypeError, "unsupported type: #{ty}")
|
||||
end
|
||||
encty.push(ty)
|
||||
if( enc )
|
||||
if( c1 )
|
||||
|
|
|
@ -129,6 +129,9 @@ module DL
|
|||
raise(RuntimeError, "invalid element: #{elem}")
|
||||
end
|
||||
_,_,_,ty,enc,dec = @types.encode_type(ty)
|
||||
if( !ty )
|
||||
raise(TypeError, "unsupported type: #{ty}")
|
||||
end
|
||||
return [name,ty,num,enc,dec]
|
||||
end
|
||||
end # class Struct
|
||||
|
|
|
@ -179,17 +179,12 @@ module DL
|
|||
dec = nil
|
||||
senc = nil
|
||||
sdec = nil
|
||||
ty1 = nil
|
||||
ty2 = nil
|
||||
ty1 = ty
|
||||
ty2 = ty
|
||||
@TYDEFS.each{|t1,t2,c1,c2,t3,c3,c4|
|
||||
# if( t1.is_a?(String) )
|
||||
# t1 = Regexp.new("^" + t1 + "$")
|
||||
# end
|
||||
if( (t1.is_a?(Regexp) && (t1 =~ ty)) || (t1 == ty) )
|
||||
ty1 = ty.gsub(t1,t2) if t2
|
||||
ty2 = ty.gsub(t1,t3) if t3
|
||||
if( (t1.is_a?(Regexp) && (t1 =~ ty1)) || (t1 == ty1) )
|
||||
ty1 = ty1.gsub(t1,t2) if t2
|
||||
ty1.strip! if ty1
|
||||
ty2.strip! if ty2
|
||||
if( enc )
|
||||
if( c1 )
|
||||
conv1 = enc
|
||||
|
@ -210,6 +205,10 @@ module DL
|
|||
dec = c2
|
||||
end
|
||||
end
|
||||
end
|
||||
if( (t1.is_a?(Regexp) && (t1 =~ ty2)) || (t1 == ty2) )
|
||||
ty2 = ty2.gsub(t1,t3) if t3
|
||||
ty2.strip! if ty2
|
||||
if( senc )
|
||||
if( c3 )
|
||||
conv3 = senc
|
||||
|
@ -230,11 +229,8 @@ module DL
|
|||
sdec = c4
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
if( ty1.length != 1 && ty2.length != 1 )
|
||||
raise(TypeError, "unknown type: #{orig_ty}.")
|
||||
end
|
||||
return [ty1,enc,dec,ty2,senc,sdec]
|
||||
end
|
||||
end # end of Types
|
||||
|
|
Loading…
Reference in a new issue