Skip to content
Snippets Groups Projects
Commit c4096908 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Print str in CBackend as str

parent 3814a508
No related branches found
No related tags found
No related merge requests found
...@@ -703,8 +703,7 @@ class DestructuringBindingsForFieldClass(Node): ...@@ -703,8 +703,7 @@ class DestructuringBindingsForFieldClass(Node):
corresponding_field_names = {s.field_name for s in undefined_field_symbols if hasattr(s, 'field_name')} corresponding_field_names = {s.field_name for s in undefined_field_symbols if hasattr(s, 'field_name')}
corresponding_field_names |= {s.field_names[0] for s in undefined_field_symbols if hasattr(s, 'field_names')} corresponding_field_names |= {s.field_names[0] for s in undefined_field_symbols if hasattr(s, 'field_names')}
return {TypedSymbol(f, self.CLASS_NAME_TEMPLATE.format(dtype=field_map[f].dtype, ndim=field_map[f].ndim) + '&') return {TypedSymbol(f, self.CLASS_NAME_TEMPLATE.format(dtype=field_map[f].dtype, ndim=field_map[f].ndim) + '&')
for f in corresponding_field_names} | \ for f in corresponding_field_names} | (self.body.undefined_symbols - undefined_field_symbols)
(self.body.undefined_symbols - undefined_field_symbols)
def subs(self, subs_dict) -> None: def subs(self, subs_dict) -> None:
"""Inplace! substitute, similar to sympy's but modifies the AST inplace.""" """Inplace! substitute, similar to sympy's but modifies the AST inplace."""
......
...@@ -168,6 +168,8 @@ class CBackend: ...@@ -168,6 +168,8 @@ class CBackend:
return result return result
def _print(self, node): def _print(self, node):
if isinstance(node, str):
return node
for cls in type(node).__mro__: for cls in type(node).__mro__:
method_name = "_print_" + cls.__name__ method_name = "_print_" + cls.__name__
if hasattr(self, method_name): if hasattr(self, method_name):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment