Sha256: ad28793f4ffc58156a8a2a5adca8263a9b0f4e1f40f4b36b9b36933d3ceb2fde

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

module Mirah
  module JVM
    module Types
      class NullType < Type
        def initialize(types)
          super(types, types.get_mirror('java.lang.Object'))
        end

        def to_s
          "Type(null)"
        end

        def null?
          true
        end

        def compatible?(other)
          assignable_from(other)
        end

        def assignable_from?(other)
          if other.respond_to?(:primitive?)
            !other.primitive?
          else
            other.matchesAnything
          end
        end

        def widen(other)
          if other.matchesAnything
            self
          else
            other
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mirah-0.1.2-java lib/mirah/jvm/types/null_type.rb
mirah-0.1.1-java lib/mirah/jvm/types/null_type.rb
mirah-0.1.0-java lib/mirah/jvm/types/null_type.rb
mirah-0.1.0.pre-java lib/mirah/jvm/types/null_type.rb