class RBS::Types::Variable

属性

location[R]
name[R]

公共类方法

build(v) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 166
def self.build(v)
  case v
  when Symbol
    new(name: v, location: nil)
  when Array
    v.map {|x| new(name: x, location: nil) }
  end
end
fresh(v = :T) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 176
def self.fresh(v = :T)
  @@count = @@count + 1
  new(name: :"#{v}@#{@@count}", location: nil)
end
new(name:, location:) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 137
def initialize(name:, location:)
  @name = name
  @location = location
end

公共实例方法

==(other) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 142
def ==(other)
  other.is_a?(Variable) && other.name == name
end
也别名为:eql?
eql?(other)
别名为:==
free_variables(set = Set.new) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 152
def free_variables(set = Set.new)
  set.tap do
    set << name
  end
end
has_classish_type?() 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 191
def has_classish_type?
  false
end
has_self_type?() 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 187
def has_self_type?
  false
end
hash() 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 148
def hash
  self.class.hash ^ name.hash
end
sub(s) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 162
def sub(s)
  s.apply(self)
end
to_json(state = _ = nil) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 158
def to_json(state = _ = nil)
  { class: :variable, name: name, location: location }.to_json(state)
end
to_s(level = 0) 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 181
def to_s(level = 0)
  name.to_s
end
with_nonreturn_void?() 点击切换源代码
# File rbs-3.8.0/lib/rbs/types.rb, line 195
def with_nonreturn_void?
  false
end