Skip to content

Commit

Permalink
Added subscript visitor method.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnick83 committed Sep 14, 2023
1 parent 36010fa commit 0bbe5c4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dace/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,15 @@ def visit_IfExp(self, node):
self.visit(node.orelse)],
keywords=[])
return ast.copy_location(new_node, node)

def visit_Subscript(self, node):
if isinstance(node.value, ast.Attribute):
attr = ast.Subscript(value=ast.Name(id=node.value.attr, ctx=ast.Load()), slice=node.slice, ctx=ast.Load())
new_node = ast.Call(func=ast.Name(id='Attr', ctx=ast.Load),
args=[self.visit(node.value.value), self.visit(attr)],
keywords=[])
return ast.copy_location(new_node, node)
return self.generic_visit(node)

def visit_Attribute(self, node):
new_node = ast.Call(func=ast.Name(id='Attr', ctx=ast.Load),
Expand Down

0 comments on commit 0bbe5c4

Please sign in to comment.