def get_function_return_type(self, function_name, args_type=[]):
function = self.functions[function_name]
if is_system_function(function_name):
return SystemFunction.get_function(function_name).return_type
if function is not None:
if function.is_args_type_match(args_type):
return function.return_type
else:
raise ParamTypeMismatchError("Function '%s' parameter type is not match", function_name)
else:
for node in self.module_node.body:
if isinstance(node, ast.FunctionDef) and node.name == function_name:
generator, return_type = self.analysis_function(node, args_type)
self.functions.append(Function(function_name, args_type, return_type, generator))
return return_type
return Type.STRING # when function is not exist: string
评论列表
文章目录