X-Git-Url: http://nitlanguage.org diff --git a/contrib/pep8analysis/src/flow_analysis/framework.nit b/contrib/pep8analysis/src/flow_analysis/framework.nit index 57444e4..338836b 100644 --- a/contrib/pep8analysis/src/flow_analysis/framework.nit +++ b/contrib/pep8analysis/src/flow_analysis/framework.nit @@ -1,23 +1,16 @@ import cfg -import advanced_collections 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 @@ -59,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 @@ -68,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)