Exception: RBS::MixinClassError

Inherits:
DefinitionError show all
Defined in:
lib/rbs/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_name:, member:) ⇒ MixinClassError

Returns a new instance of MixinClassError.



395
396
397
398
399
400
# File 'lib/rbs/errors.rb', line 395

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

Instance Attribute Details

#memberObject (readonly)

Returns the value of attribute member.



393
394
395
# File 'lib/rbs/errors.rb', line 393

def member
  @member
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



392
393
394
# File 'lib/rbs/errors.rb', line 392

def type_name
  @type_name
end

Class Method Details

.check!(type_name:, env:, member:) ⇒ Object



406
407
408
409
410
# File 'lib/rbs/errors.rb', line 406

def self.check!(type_name:, env:, member:)
  if env.class_decl?(member.name)
    raise new(type_name: type_name, member: member)
  end
end

Instance Method Details

#locationObject



402
403
404
# File 'lib/rbs/errors.rb', line 402

def location
  member.location
end