Skip to content

Commit

Permalink
simplify TypedSymbol handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfhm committed Oct 17, 2023
1 parent e68135b commit 2653b84
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions loki/transform/transform_scalar_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ def construct_range_index(lower, length):
return RangeIndex((lower, new_high))


def merge_parents(parent, symbol):

new_parent = parent.clone()
for p in symbol.parents[1:]:
new_parent = TypedSymbol(name=p.name_parts[-1], scope=parent.scope, parent=new_parent)
return symbol.clone(parent=new_parent, scope=parent.scope)


def process_symbol(symbol, caller, call):

if isinstance(symbol, IntLiteral):

Check failure on line 58 in loki/transform/transform_scalar_syntax.py

View workflow job for this annotation

GitHub Actions / code checks (3.11)

R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
Expand All @@ -72,7 +64,7 @@ def process_symbol(symbol, caller, call):

elif isinstance(symbol, TypedSymbol):
if symbol.parents[0] in call.routine.arguments:
return merge_parents(call.arg_map[symbol.parents[0]], symbol)
return SubstituteExpressions(call.arg_map).visit(symbol)

if call.routine in caller.members and symbol in caller.variables:
return symbol
Expand Down

0 comments on commit 2653b84

Please sign in to comment.