From 909476f4bdcdaea7d5724019d2fb46ec304cc755 Mon Sep 17 00:00:00 2001 From: David Kerkeslager Date: Fri, 27 Sep 2019 20:51:51 -0400 Subject: [PATCH] Handle anonymous lambdas --- crossplatform_ir_generation.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crossplatform_ir_generation.py b/crossplatform_ir_generation.py index fad6222..7f8a6ec 100644 --- a/crossplatform_ir_generation.py +++ b/crossplatform_ir_generation.py @@ -60,13 +60,18 @@ def generate_integer_literal_expression(counters, expression): return referenced_entry_list, instruction_list +def escape_name(name): + return name.replace('$','$$').replace('_','$') + def generate_lambda_expression(counters, expression): - if expression.name is None or 'lambda' in expression.name.lower(): - import ipdb; ipdb.set_trace() + if expression.name is None: + name = '__lambda__' + else: + name = escape_name(expression.name) - name_counter = counters.get(expression.name, 0) + name_counter = counters.get(name, 0) counters[expression.name] = name_counter + 1 - label = '{}${}'.format(expression.name, name_counter) + label = '{}${}'.format(name, name_counter) referenced_entry_list_list = [] instruction_list_list = [] -- 2.20.1