From 6de92f6092e0e4a3e834205b250ce76c9ae0c3f5 Mon Sep 17 00:00:00 2001
From: Rafael Ravedutti Lucio Machado <rafael.r.ravedutti@fau.de>
Date: Sat, 9 Jan 2021 00:03:06 +0100
Subject: [PATCH] Remove code not used anymore

Signed-off-by: Rafael Ravedutti Lucio Machado <rafael.r.ravedutti@fau.de>
---
 ast/arrays.py              |  4 ----
 ast/ast_node.py            |  3 ---
 ast/bin_op.py              |  4 ----
 ast/block.py               | 14 --------------
 ast/cast.py                |  3 ---
 ast/math.py                |  3 ---
 ast/properties.py          |  4 ----
 ast/variables.py           |  3 ---
 sim/particle_simulation.py |  1 -
 9 files changed, 39 deletions(-)

diff --git a/ast/arrays.py b/ast/arrays.py
index e7fd2c7..308bd12 100644
--- a/ast/arrays.py
+++ b/ast/arrays.py
@@ -115,7 +115,6 @@ class ArrayAccess(ASTTerm):
         self.array = array
         self.indexes = [as_lit_ast(sim, index)]
         self.index = None
-        self.mutable = True
         self.generated = False
         self.check_and_set_index()
 
@@ -161,9 +160,6 @@ class ArrayAccess(ASTTerm):
         return self.array.type()
         # return self.array.type() if self.index is None else Type_Array
 
-    def is_mutable(self):
-        return self.mutable
-
     def scope(self):
         if self.index is None:
             scope = None
diff --git a/ast/ast_node.py b/ast/ast_node.py
index b0641f4..7e42676 100644
--- a/ast/ast_node.py
+++ b/ast/ast_node.py
@@ -11,9 +11,6 @@ class ASTNode:
     def type(self):
         return Type_Invalid
 
-    def is_mutable(self):
-        return False
-
     def scope(self):
         return self.sim.global_scope
 
diff --git a/ast/bin_op.py b/ast/bin_op.py
index 4cc8dd5..840ca43 100644
--- a/ast/bin_op.py
+++ b/ast/bin_op.py
@@ -46,7 +46,6 @@ class BinOp(ASTNode):
         self.rhs = as_lit_ast(sim, rhs)
         self.op = op
         self.mem = mem
-        self.mutable = self.lhs.is_mutable() or self.rhs.is_mutable() # Value can change accross references
         self.inlined = False
         self.generated = False
         self.bin_op_type = BinOp.infer_type(self.lhs, self.rhs, self.op)
@@ -167,9 +166,6 @@ class BinOp(ASTNode):
     def kind(self):
         return BinOp.Kind_Vector if self.type() == Type_Vector else BinOp.Kind_Scalar
 
-    def is_mutable(self):
-        return self.mutable
-
     def scope(self):
         if self.bin_op_scope is None:
             lhs_scp = self.lhs.scope()
diff --git a/ast/block.py b/ast/block.py
index 45fbf74..b7f287e 100644
--- a/ast/block.py
+++ b/ast/block.py
@@ -71,17 +71,3 @@ class Block(ASTNode):
             result_block = Block.merge_blocks(result_block, block)
 
         return result_block
-
-    def set_block_levels(ast):
-        Block.level = 0
-
-        def enter(ast):
-            if isinstance(ast, Block):
-                ast.set_level(Block.level)
-                Block.level += 1
-
-        def leave(ast):
-            if isinstance(ast, Block):
-                Block.level -= 1
-
-        Visitor(ast, enter, leave).visit()
diff --git a/ast/cast.py b/ast/cast.py
index 5bf1ba9..0a30700 100644
--- a/ast/cast.py
+++ b/ast/cast.py
@@ -20,9 +20,6 @@ class Cast(ASTNode):
     def type(self):
         return self.cast_type
 
-    def is_mutable(self):
-        return self.expr.is_mutable()
-
     def scope(self):
         return self.expr.scope()
 
diff --git a/ast/math.py b/ast/math.py
index c872b5b..90977b8 100644
--- a/ast/math.py
+++ b/ast/math.py
@@ -13,9 +13,6 @@ class Sqrt(ASTNode):
     def type(self):
         return self.expr.type()
 
-    def is_mutable(self):
-        return self.expr.is_mutable()
-
     def scope(self):
         return self.expr.scope()
 
diff --git a/ast/properties.py b/ast/properties.py
index 44f141c..fee0151 100644
--- a/ast/properties.py
+++ b/ast/properties.py
@@ -47,7 +47,6 @@ class Property(ASTNode):
         self.prop_layout = layout
         self.default_value = default
         self.volatile = volatile
-        self.mutable = True
 
     def __str__(self):
         return f"Property<{self.prop_name}>"
@@ -64,9 +63,6 @@ class Property(ASTNode):
     def default(self):
         return self.default_value
 
-    def is_mutable(self):
-        return self.mutable
-
     def scope(self):
         return self.sim.global_scope
 
diff --git a/ast/variables.py b/ast/variables.py
index 34f9a9d..aed0821 100644
--- a/ast/variables.py
+++ b/ast/variables.py
@@ -60,9 +60,6 @@ class Var(ASTTerm):
     def bonded_arrays(self):
         return self.var_bonded_arrays
 
-    def is_mutable(self):
-        return self.mutable
-
 
 class VarDecl(ASTNode):
     def __init__(self, sim, var):
diff --git a/sim/particle_simulation.py b/sim/particle_simulation.py
index 52c9e0f..12104a3 100644
--- a/sim/particle_simulation.py
+++ b/sim/particle_simulation.py
@@ -193,7 +193,6 @@ class ParticleSimulation:
 
         program = Block.merge_blocks(decls, body)
         self.global_scope = program
-        Block.set_block_levels(program)
         Transform.apply(program, Transform.flatten)
         Transform.apply(program, Transform.simplify)
         #Transform.apply(program, Transform.reuse_index_expressions)
-- 
GitLab