Sha256: 775c9670069d37dd25ebf348be8f5bc95669deccf68fe267a474f341b40cf6bf
Contents?: true
Size: 990 Bytes
Versions: 19
Compression:
Stored size: 990 Bytes
Contents
module Simplabs module Excellent module Parsing class ResbodyContext < SexpContext #:nodoc: STATEMENT_NODES = [:fcall, :return, :attrasgn, :vcall, :call, :str, :lit, :hash, :false, :true, :nil] def initialize(exp, parent) super @contains_statements = contains_statements? end def has_statements? @contains_statements end private def contains_statements?(exp = @exp) return true if STATEMENT_NODES.include?(exp.node_type) return true if assigning_other_than_exception_to_local_variable?(exp) return true if (exp[1][0] == :array && exp[2][0] == :array rescue false) return true if exp.children.any? { |child| contains_statements?(child) } end def assigning_other_than_exception_to_local_variable?(exp) exp.node_type == :lasgn && exp[2].to_a != [:gvar, :$!] end end end end end
Version data entries
19 entries across 19 versions & 2 rubygems