Eolian: Raise an exception if property return type is unknown

This commit is contained in:
Kai Huuhko 2014-06-20 12:03:43 +03:00
parent 0ee569672b
commit 7ba7bef479
1 changed files with 10 additions and 8 deletions

View File

@ -216,8 +216,6 @@ class Method(object):
pdir, ptype, name, desc = p.information
ptype2 = ptype.replace("const ", "").replace("unsigned ", "")
if not ptype2 in param_type_mapping:
for t in eolian.type_find_by_alias(ptype2):
print(t)
raise TypeError("Unknown param type: %s" % (ptype2))
self.params.append((ptype, name))
if pdir == eolian.ParameterDir.IN:
@ -238,8 +236,6 @@ class Method(object):
if ret_type:
ret_type2 = ret_type.replace("const ", "").replace("unsigned ", "")
if not ret_type2 in return_type_mapping:
for t in eolian.type_find_by_alias(ret_type2):
print(t)
raise TypeError("Unknown return type: %s" % (ret_type2))
self.ret_type = ret_type
ret_desc = func.return_comment_get(func.type)
@ -382,8 +378,6 @@ class Property(object):
assert pdir == eolian.ParameterDir.IN, "prop has other than IN"
ptype2 = ptype.replace("const ", "").replace("unsigned ", "")
if not ptype2 in param_type_mapping:
for t in eolian.type_find_by_alias(ptype2):
print(t)
raise TypeError("Unknown param type: %s" % (ptype2))
m.params.append((ptype, name))
py_params.append(name)
@ -398,6 +392,11 @@ class Property(object):
m.py_params = (("", "value"),)
m.ret_type = func.return_type_get(eolian.FunctionType.PROP_SET)
if m.ret_type:
ret_type2 = m.ret_type.replace(
"const ", "").replace("unsigned ", "")
if not ret_type2 in return_type_mapping:
raise TypeError("Unknown return type: %s" % (ret_type2))
if func.type == eolian.FunctionType.PROP_GET or \
func.type == eolian.FunctionType.PROPERTY:
@ -410,8 +409,6 @@ class Property(object):
assert pdir == eolian.ParameterDir.IN, "prop has other than IN"
ptype2 = ptype.replace("const ", "").replace("unsigned ", "")
if not ptype2 in param_type_mapping:
for t in eolian.type_find_by_alias(ptype2):
print(t)
raise TypeError("Unknown param type: %s" % (ptype2))
m.params.append((ptype, name))
m.cdefs.append((ptype, name))
@ -419,6 +416,11 @@ class Property(object):
m.returns.append((ptype, name))
m.ret_type = func.return_type_get(eolian.FunctionType.PROP_GET)
if m.ret_type:
ret_type2 = m.ret_type.replace(
"const ", "").replace("unsigned ", "")
if not ret_type2 in return_type_mapping:
raise TypeError("Unknown return type: %s" % (ret_type2))
return self