mirror of https://github.com/ecmwf/eccodes.git
Fixed bug with detecting base func calls
This commit is contained in:
parent
ba803aa537
commit
6e889576fc
|
@ -170,9 +170,12 @@ class ConversionData:
|
|||
cppargs = []
|
||||
for entry in cppfunction_call.args:
|
||||
cppname = arg_utils.extract_name(entry)
|
||||
cpparg = self.cpparg_for_cname(cppname) if cppname else None
|
||||
if not cppname:
|
||||
debug.line("add_cppfunction_call", f"Couldn't deduce name for entry=[{debug.as_debug_string(entry)}] cppfunction_call=[{debug.as_debug_string(cppfunction_call)}]")
|
||||
return
|
||||
|
||||
cpparg = self.cpparg_for_cname(cppname)
|
||||
debug.line("add_cppfunction_call", f"[{debug.as_debug_string(cppfunction_call)}]---> entry type=[{type(entry)}] value=[{debug.as_debug_string(entry)}] cppname=[{debug.as_debug_string(cppname)}] cpparg=[{debug.as_debug_string(cpparg)}]")
|
||||
assert cppname
|
||||
|
||||
if cpparg and cpparg != NONE_VALUE:
|
||||
cppargs.append(cpparg)
|
||||
|
|
|
@ -144,12 +144,17 @@ class GribAccessorConversionValidation(default_conversion_validation.DefaultConv
|
|||
|
||||
debug.line("validate_return_statement", f"creturn_statement=[{debug.as_debug_string(creturn_statement)}] cppreturn_statement=[{debug.as_debug_string(cppreturn_statement)}]")
|
||||
|
||||
if isinstance(cppreturn_statement.expression, function_call.FunctionCall):
|
||||
debug.line("validate_return_statement", f"cppreturn_statement.expression is a function call, assuming the function returns the correct type")
|
||||
else:
|
||||
mapping = self._conversion_data.funcsig_mapping_for_current_cfuncname()
|
||||
if mapping:
|
||||
cppfunc_return_type = mapping.cppfuncsig.return_type.type
|
||||
cpparg = arg_utils.to_cpparg(cppreturn_statement.expression, self._conversion_data)
|
||||
updated_cpp_expression = None
|
||||
|
||||
debug.line("validate_return_statement", f"RETURN DEBUG: cppreturn_statement.expression=[{type(cppreturn_statement.expression)}]")
|
||||
|
||||
if cpparg:
|
||||
if cpparg.decl_spec.type != cppfunc_return_type:
|
||||
updated_cpp_expression = literal.Literal(f"static_cast<GribStatus>({cpparg.name})")
|
||||
|
|
Loading…
Reference in New Issue