From c44ce007b7ebbcd5917bea3edc32d94f2d8a5651 Mon Sep 17 00:00:00 2001 From: Daniel Bauer <daniel.j.bauer@fau.de> Date: Fri, 19 Jan 2024 11:41:36 +0100 Subject: [PATCH] implement fast_subs for array declaration --- pystencils/astnodes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pystencils/astnodes.py b/pystencils/astnodes.py index 7f0109465..18c718bfc 100644 --- a/pystencils/astnodes.py +++ b/pystencils/astnodes.py @@ -983,9 +983,14 @@ class ArrayDeclaration(Node): self._lhs = self.lhs.subs(substitutions) self._entries = [e.subs(substitutions) for e in self._entries] + def fast_subs(self, subs_dict, skip=None): + self._lhs = fast_subs(self.lhs, subs_dict, skip) + self._entries = [fast_subs(e, subs_dict, skip) for e in self._entries] + return self + def __str__(self): entry_str = ", ".join( [str(e) for e in self._entries]) return f"const {self._lhs.dtype.base_type} {self._lhs.name} [] = {{{ entry_str }}};\n" def __repr__(self): - return self.__str__() \ No newline at end of file + return self.__str__() -- GitLab