Skip to content

Commit 1a9104d

Browse files
authored
Remove unused parameters from Assign (pyccel#1825)
Remove the unused properties `status`, `like`, and `expr` from the class `Assign`, where they don't make sense. It seems they may have been copied accidentally from `Allocate`.
1 parent cdf045a commit 1a9104d

File tree

2 files changed

+12
-39
lines changed

2 files changed

+12
-39
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ All notable changes to this project will be documented in this file.
4949
- \[INTERNALS\] Remove unused properties `prefix` and `alias` from `CustomDataType`.
5050
- \[INTERNALS\] Remove `ast.basic.TypedAstNode._dtype`. The datatype can still be accessed as it is contained within the class type.
5151
- \[INTERNALS\] Removed unused and undocumented function `get_function_from_ast`.
52+
- \[INTERNALS\] Remove unused parameters `expr`, `status` and `like` from `pyccel.ast.core.Assign`.
5253

5354
## \[1.11.2\] - 2024-03-05
5455

pyccel/ast/core.py

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,6 @@ class Assign(PyccelAstNode):
280280
In the semantic stage :
281281
TypedAstNode with the same shape as the lhs.
282282
283-
status : str, optional
284-
If lhs is not allocatable, then status is None.
285-
otherwise, status is {'allocated', 'unallocated'}.
286-
287-
like : Variable, optional
288-
Contains the name of the variable from which the lhs will be cloned.
289-
290283
python_ast : ast.Ast
291284
The ast object parsed by Python's ast module.
292285
@@ -307,24 +300,20 @@ class Assign(PyccelAstNode):
307300
>>> Assign(A[0,1], x)
308301
IndexedElement(A, 0, 1) := x
309302
"""
310-
__slots__ = ('_lhs', '_rhs', '_status', '_like')
303+
__slots__ = ('_lhs', '_rhs')
311304
_attribute_nodes = ('_lhs', '_rhs')
312305

313306
def __init__(
314307
self,
315308
lhs,
316309
rhs,
317-
status=None,
318-
like=None,
319310
*,
320311
python_ast = None
321312
):
322313
if isinstance(lhs, (tuple, list)):
323314
lhs = PythonTuple(*lhs)
324315
self._lhs = lhs
325316
self._rhs = rhs
326-
self._status = status
327-
self._like = like
328317
super().__init__()
329318
if python_ast is not None:
330319
self.set_current_ast(python_ast)
@@ -343,20 +332,6 @@ def lhs(self):
343332
def rhs(self):
344333
return self._rhs
345334

346-
# TODO : remove
347-
348-
@property
349-
def expr(self):
350-
return self.rhs
351-
352-
@property
353-
def status(self):
354-
return self._status
355-
356-
@property
357-
def like(self):
358-
return self._like
359-
360335
@property
361336
def is_alias(self):
362337
"""Returns True if the assignment is an alias."""
@@ -804,12 +779,6 @@ class AugAssign(Assign):
804779
rhs : TypedAstNode
805780
Object representing the rhs of the expression.
806781
807-
status : str, optional
808-
See Assign.
809-
810-
like : TypedAstNode, optional
811-
See Assign.
812-
813782
python_ast : ast.AST
814783
The AST node where the object appeared in the original code.
815784
@@ -835,8 +804,6 @@ def __init__(
835804
lhs,
836805
op,
837806
rhs,
838-
status=None,
839-
like=None,
840807
*,
841808
python_ast = None
842809
):
@@ -846,7 +813,7 @@ def __init__(
846813

847814
self._op = op
848815

849-
super().__init__(lhs, rhs, status, like, python_ast=python_ast)
816+
super().__init__(lhs, rhs, python_ast=python_ast)
850817

851818
def __repr__(self):
852819
return f'{self.lhs} {self.op}= {self.rhs}'
@@ -857,16 +824,21 @@ def op(self):
857824

858825
def to_basic_assign(self):
859826
"""
860-
Convert the AugAssign to an Assign
827+
Convert the AugAssign to an Assign.
828+
829+
Convert the AugAssign to an Assign.
861830
E.g. convert:
862831
a += b
863832
to:
864833
a = a + b
834+
835+
Returns
836+
-------
837+
Assign
838+
An assignment equivalent to the AugAssign.
865839
"""
866840
return Assign(self.lhs,
867-
self._accepted_operators[self._op](self.lhs, self.rhs),
868-
status = self.status,
869-
like = self.like)
841+
self._accepted_operators[self._op](self.lhs, self.rhs))
870842

871843

872844
class While(ScopedAstNode):

0 commit comments

Comments
 (0)