Merge pull request #11 from reventlov/fix_python2
Make Emboss work under Python 2 again.
diff --git a/compiler/back_end/cpp/header_generator.py b/compiler/back_end/cpp/header_generator.py
index a10adf9..7efd471 100644
--- a/compiler/back_end/cpp/header_generator.py
+++ b/compiler/back_end/cpp/header_generator.py
@@ -558,7 +558,7 @@
expression, ir, "view_.", subexpressions)
-class _SubexpressionStore:
+class _SubexpressionStore(object):
"""Holder for subexpressions to be assigned to local variables."""
def __init__(self, prefix):
@@ -811,8 +811,8 @@
virtual_view_type_name=virtual_view_type_name,
logical_type=logical_type,
read_subexpressions="".join(
- [" const auto {} = {};".format(name, subexpr)
- for name, subexpr in read_subexpressions.subexprs()]
+ [" const auto {} = {};\n".format(subexpr_name, subexpr)
+ for subexpr_name, subexpr in read_subexpressions.subexprs()]
),
read_value=read_value.rendered,
write_to_text_stream_function=write_to_text_stream_function,
@@ -876,7 +876,6 @@
_get_cpp_type_reader_of_field(field_ir, ir, "Storage", validator_type,
parent_addressable_unit))
-
field_name = field_ir.name.canonical_name.object_path[-1]
subexpressions = _SubexpressionStore("emboss_reserved_local_subexpr_")
@@ -902,10 +901,9 @@
size_and_offset_subexpressions = "".join(
[" const auto {} = {};\n".format(name, subexpr)
for name, subexpr in subexpressions.subexprs()[
- first_size_and_offset_subexpr:]]
+ first_size_and_offset_subexpr:]]
)
-
field_alignment, field_offset = _alignment_of_location(field_ir.location)
declaration = code_template.format_template(
_TEMPLATES.structure_single_field_method_declarations,