From 729c787de301df8c6381a46d97fac0d3873e8a51 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Aug 2019 14:03:12 +0200 Subject: codegen: add minimal support for overloaded functions --- lib/codegen.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/codegen.py b/lib/codegen.py index d6dfe6e..b383f20 100644 --- a/lib/codegen.py +++ b/lib/codegen.py @@ -52,11 +52,11 @@ class MultipassDriver: # XXX right now we only verify whether both functions have the # same number of arguments. This breaks in many overloading cases. function_info = self.class_info.function[transition.name] - function_arguments = list() + for function_candidate in self.class_info.functions: + if function_candidate.name == transition.name and len(function_candidate.argument_types) == len(transition.arguments): + function_info = function_candidate - if len(transition.arguments) != len(function_info.argument_types): - # polymorphic function variant, TODO - pass + function_arguments = list() for i in range(len(transition.arguments)): function_arguments.append('{} {}'.format(function_info.argument_types[i], transition.arguments[i])) -- cgit v1.2.3