summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-08-30 14:03:12 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-08-30 14:03:12 +0200
commit729c787de301df8c6381a46d97fac0d3873e8a51 (patch)
tree7145a350dba953891428d5ca874e91900a02ebed /lib
parent855bc77bcf3a39859e590abc4b95311b317c1b49 (diff)
codegen: add minimal support for overloaded functions
Diffstat (limited to 'lib')
-rw-r--r--lib/codegen.py8
1 files changed, 4 insertions, 4 deletions
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]))