Sha256: ce0395b9b3c7d7358097cba4e54b693171cf9a653998a54d4e3b2e5ef943453c
Contents?: true
Size: 939 Bytes
Versions: 3
Compression:
Stored size: 939 Bytes
Contents
module Steep module AST module Types class Var attr_reader :name attr_reader :location def initialize(name:, location: nil) @name = name @location = location end def ==(other) other.is_a?(Var) && other.name == name end def hash self.class.hash ^ name.hash end alias eql? == def self.fresh(name) @mutex ||= Mutex.new @mutex.synchronize do @max ||= 0 @max += 1 new(name: :"#{name}(#{@max})") end end def to_s "'#{name}" end def subst(s) if s.key?(name) s[name] else self end end def free_variables Set.new([name]) end def level [0] end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
steep-0.3.0 | lib/steep/ast/types/var.rb |
steep-0.2.0 | lib/steep/ast/types/var.rb |
steep-0.1.0 | lib/steep/ast/types/var.rb |