Skip to content
Snippets Groups Projects
Commit 2f713b3a authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Make evaluator compatible with re-evaluating symbolic expressions when...

Make evaluator compatible with re-evaluating symbolic expressions when subscript-by-getitem is disabled
parent c50ce18f
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,13 @@ class EvaluationMapper(RecursiveMapper, CSECachingMapperMixin):
return self.rec(expr.function)(*args, **kwargs)
def map_subscript(self, expr):
return self.rec(expr.aggregate)[self.rec(expr.index)]
rec_result = self.rec(expr.aggregate)
from pymbolic.primitives import Expression
if isinstance(rec_result, Expression):
return rec_result.index(self.rec(expr.index))
else:
return rec_result[self.rec(expr.index)]
def map_lookup(self, expr):
return getattr(self.rec(expr.aggregate), expr.name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment