Sha256: f47a80a94a69fcd7a27d2ac5fbaa9feef22aa2e1aa50d62ab87effdc1cc86b52

Contents?: true

Size: 1.97 KB

Versions: 19

Compression:

Stored size: 1.97 KB

Contents

module Steep
  module AST
    module Types
      module Logic
        class Base
          attr_reader :location

          def subst(s)
            self
          end

          include Helper::NoFreeVariables

          include Helper::NoChild

          def hash
            self.class.hash
          end

          def ==(other)
            other.class == self.class
          end

          alias eql? ==

          def to_s
            "<% #{self.class} %>"
          end

          def level
            [0]
          end
        end

        class Not < Base
          def initialize(location: nil)
            @location = location
          end
        end

        class ReceiverIsNil < Base
          def initialize(location: nil)
            @location = location
          end
        end

        class ReceiverIsNotNil < Base
          def initialize(location: nil)
            @location = location
          end
        end

        class ReceiverIsArg < Base
          def initialize(location: nil)
            @location = location
          end
        end

        class ArgIsReceiver < Base
          def initialize(location: nil)
            @location = location
          end
        end

        class ArgEqualsReceiver < Base
          def initialize(location: nil)
            @location = location
          end
        end

        class Env < Base
          attr_reader :truthy, :falsy, :type

          def initialize(truthy:, falsy:, type:, location: nil)
            @truthy = truthy
            @falsy = falsy
            @type = type
          end

          def ==(other)
            other.is_a?(Env) && other.truthy == truthy && other.falsy == falsy && other.type == type
          end

          alias eql? ==

          def hash
            self.class.hash ^ truthy.hash ^ falsy.hash
          end

          def inspect
            "#<Steep::AST::Types::Env @type=#{type}, @truthy=..., @falsy=...>"
          end

          alias to_s inspect
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
steep-1.5.3 lib/steep/ast/types/logic.rb
steep-1.5.2 lib/steep/ast/types/logic.rb
steep-1.5.1 lib/steep/ast/types/logic.rb
steep-1.5.0 lib/steep/ast/types/logic.rb
steep-1.5.0.pre.6 lib/steep/ast/types/logic.rb
steep-1.5.0.pre.5 lib/steep/ast/types/logic.rb
steep-1.5.0.pre.4 lib/steep/ast/types/logic.rb
steep-1.5.0.pre.3 lib/steep/ast/types/logic.rb
steep-1.5.0.pre.2 lib/steep/ast/types/logic.rb
steep-1.5.0.pre.1 lib/steep/ast/types/logic.rb
steep-1.4.0 lib/steep/ast/types/logic.rb
steep-1.4.0.dev.5 lib/steep/ast/types/logic.rb
steep-1.4.0.dev.4 lib/steep/ast/types/logic.rb
steep-1.4.0.dev.3 lib/steep/ast/types/logic.rb
steep-1.3.2 lib/steep/ast/types/logic.rb
steep-1.3.1 lib/steep/ast/types/logic.rb
steep-1.4.0.dev.2 lib/steep/ast/types/logic.rb
steep-1.4.0.dev.1 lib/steep/ast/types/logic.rb
steep-1.3.0 lib/steep/ast/types/logic.rb