code: remove useless `or else` now that they are detected
[nit.git] / contrib / pep8analysis / src / flow_analysis / framework.nit
index a2e9e65..338836b 100644 (file)
@@ -3,20 +3,14 @@ import cfg
 class FlowAnalysis[S]
        super Visitor
 
-       var current_in:  nullable S writable
-       var current_out: nullable S writable
+       var current_in:  nullable S = default_in_set is writable
+       var current_out: nullable S = default_in_set is writable
 
        fun in_set(bb: BasicBlock): nullable S is abstract
        fun out_set(bb: BasicBlock): nullable S is abstract
        fun in_set=(bb: BasicBlock, s: S) is abstract
        fun out_set=(bb: BasicBlock, s: S) is abstract
 
-       init
-       do
-               current_in = default_in_set
-               current_out = default_in_set
-       end
-
        redef fun visit( node ) do node.visit_all(self)
 
        # If false, it is a backwards analysis
@@ -58,7 +52,7 @@ class FlowAnalysis[S]
                        end
 
                        if current_in != null then
-                               in_set(block) = current_in.as(not null)
+                               in_set(block) = current_in
                        else
                                continue
                        end
@@ -67,7 +61,7 @@ class FlowAnalysis[S]
 
                        var old_out = out_set(block)
                        for line in block.lines do
-                               self.current_in = current_in.as(not null)
+                               self.current_in = current_in
                                self.current_out = empty_set
                                pre_line_visit(line)
                                enter_visit(line)