Sha256: b8ed6e159bedbcf983f58bb143a1ad1ddf5ee28b14e5e5f72976b4926195bafb
Contents?: true
Size: 909 Bytes
Versions: 15
Compression:
Stored size: 909 Bytes
Contents
# frozen_string_literal: true require_relative 'branch' module DeepCover class Node class ShortCircuit < Node include Branch has_tracker :conditional has_child lhs: Node has_child conditional: Node, flow_entry_count: :conditional_tracker_hits, rewrite: '(%{conditional_tracker};%{node})' def branches [ conditional, TrivialBranch.new(condition: lhs, other_branch: conditional), ] end def branches_summary(of_branches) of_branches.map do |jump| if jump == conditional 'right-hand side' else "#{type == :and ? 'falsy' : 'truthy'} shortcut" end end.join(' and ') end def operator loc_hash[:operator].source.to_sym end end class And < ShortCircuit end class Or < ShortCircuit end end end
Version data entries
15 entries across 15 versions & 1 rubygems