class RBS::MixinClassError

Attributes

member[R]
type_name[R]

Public Class Methods

check!(type_name:, env:, member:) click to toggle source
# File rbs-3.4.0/lib/rbs/errors.rb, line 452
def self.check!(type_name:, env:, member:)
  if env.class_decl?(member.name)
    raise new(type_name: type_name, member: member)
  end
end
new(type_name:, member:) click to toggle source
Calls superclass method
# File rbs-3.4.0/lib/rbs/errors.rb, line 441
def initialize(type_name:, member:)
  @type_name = type_name
  @member = member

  super "#{Location.to_string member.location}: Cannot #{mixin_name} a class `#{member.name}` in the definition of `#{type_name}`"
end

Public Instance Methods

location() click to toggle source
# File rbs-3.4.0/lib/rbs/errors.rb, line 448
def location
  member.location
end

Private Instance Methods

mixin_name() click to toggle source
# File rbs-3.4.0/lib/rbs/errors.rb, line 460
def mixin_name
  case member
  when AST::Members::Prepend
    "prepend"
  when AST::Members::Include
    "include"
  when AST::Members::Extend
    "extend"
  else
    raise
  end
end