Class: MilkTea::ControlFlow::Termination
- Inherits:
-
Object
- Object
- MilkTea::ControlFlow::Termination
- Defined in:
- lib/milk_tea/core/control_flow/termination.rb
Class Method Summary collapse
- .block_always_terminates?(statements, **builder_options) ⇒ Boolean
- .block_always_terminates_in_loop?(statements, **builder_options) ⇒ Boolean
- .loop_body_always_exits?(statements, **builder_options) ⇒ Boolean
Class Method Details
.block_always_terminates?(statements, **builder_options) ⇒ Boolean
6 7 8 9 10 11 12 |
# File 'lib/milk_tea/core/control_flow/termination.rb', line 6 def self.block_always_terminates?(statements, **) return false if statements.nil? || statements.empty? graph = Builder.new(**).build(statements) reachability = Reachability.solve(graph) !reachability.reachable_ids.include?(graph.exit_id) end |
.block_always_terminates_in_loop?(statements, **builder_options) ⇒ Boolean
22 23 24 25 26 27 28 |
# File 'lib/milk_tea/core/control_flow/termination.rb', line 22 def self.block_always_terminates_in_loop?(statements, **) return false if statements.nil? || statements.empty? graph = Builder.new(**).build_loop_branch(statements) reachability = Reachability.solve(graph) !reachability.reachable_ids.include?(graph.exit_id) end |
.loop_body_always_exits?(statements, **builder_options) ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/milk_tea/core/control_flow/termination.rb', line 14 def self.loop_body_always_exits?(statements, **) return false if statements.nil? || statements.empty? graph = Builder.new(**).build_loop_body(statements) reachability = Reachability.solve(graph) !reachability.reachable_ids.include?(graph.exit_id) end |