Skip to content

Commit

Permalink
Remove scope argument of addExplicitArrayBounds
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienRietteMTO committed Oct 11, 2024
1 parent 8da84f7 commit 8b82e04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/pyft/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ def setPRESENTby(node, var, val):
mainScope.addArrayParenthesesInNode(callStmt)

# Add explcit bounds
self.addExplicitArrayBounds(node=callStmt, scope=mainScope)
mainScope.addExplicitArrayBounds(node=callStmt)

# Detect if subroutine is called on arrays
arrayRincallStmt = callStmt.findall('.//{*}array-R')
Expand Down
17 changes: 3 additions & 14 deletions src/pyft/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,26 +682,15 @@ def removeUnusedLocalVar(self, excludeList=None, simplify=False):
self.removeVarIfUnused(allVar, excludeDummy=True, excludeModule=True, simplify=simplify)

@debugDecor
def addExplicitArrayBounds(self, node=None, scope=None):
def addExplicitArrayBounds(self, node=None):
"""
Replace ':' by explicit arrays bounds.
:param node: xml node in which ':' must be replaced (None to replace everywhere)
:param scope: scope
If node is not None, scopePath can be None (and the scope path
will be guessed) or must correspond to the node.
If node is None, scopePath can be None to search everywhere or be defined
to restrain search to this scope or list of scopes.
"""
if node is None:
if scope is None:
nodes = [(sc, sc) for sc in self.getScopes(excludeContains=True)]
else:
nodes = [(sc, sc) for sc in scope.getScopes(excludeContains=True)]
nodes = [(scope, scope) for scope in self.getScopes(excludeContains=True)]
else:
if scope is None:
nodes = [(self.getParentScopeNode(node), node)]
else:
nodes = [(scope, node)]
nodes = [(self, node)]

for (scope, childNode) in nodes:
for parent4 in [parent4 for parent4
Expand Down

0 comments on commit 8b82e04

Please sign in to comment.