Class: BiteScript::ASM::SignatureMirror

Inherits:
SignatureVisitor
  • Object
show all
Includes:
SignatureVisitor
Defined in:
lib/bitescript/mirror.rb,
lib/bitescript/asm3/mirror.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(signature = nil) ⇒ SignatureMirror

Returns a new instance of SignatureMirror.



463
464
465
466
467
468
469
470
471
472
473
# File 'lib/bitescript/mirror.rb', line 463

def initialize(signature=nil)
  super(BiteScript::ASM::Opcodes::ASM4)
  @type_parameters = []
  @parameter_types = []
  @exception_types = []
  @interfaces = []
  if (signature)
    reader = BiteScript::ASM::SignatureReader.new(signature)
    reader.accept(self)
  end
end

Instance Attribute Details

#exception_typesObject (readonly)

Returns the value of attribute exception_types.



452
453
454
# File 'lib/bitescript/mirror.rb', line 452

def exception_types
  @exception_types
end

#interfacesObject (readonly)

Returns the value of attribute interfaces.



453
454
455
# File 'lib/bitescript/mirror.rb', line 453

def interfaces
  @interfaces
end

#parameter_typesObject (readonly)

Returns the value of attribute parameter_types.



452
453
454
# File 'lib/bitescript/mirror.rb', line 452

def parameter_types
  @parameter_types
end

#return_typeObject (readonly)

Returns the value of attribute return_type.



452
453
454
# File 'lib/bitescript/mirror.rb', line 452

def return_type
  @return_type
end

#superclassObject (readonly)

Returns the value of attribute superclass.



453
454
455
# File 'lib/bitescript/mirror.rb', line 453

def superclass
  @superclass
end

#type_parametersObject (readonly)

Returns the value of attribute type_parameters.



451
452
453
# File 'lib/bitescript/mirror.rb', line 451

def type_parameters
  @type_parameters
end

Instance Method Details

#class?Boolean

Returns:

  • (Boolean)


459
460
461
# File 'lib/bitescript/mirror.rb', line 459

def class?
  superclass != nil
end

#method?Boolean

Returns:

  • (Boolean)


455
456
457
# File 'lib/bitescript/mirror.rb', line 455

def method?
  return_type != nil
end

#visitClassBoundObject



479
480
481
# File 'lib/bitescript/mirror.rb', line 479

def visitClassBound
  GenericTypeBuilder.new {|bound| type_parameters[-1].bounds << bound}
end

#visitExceptionTypeObject



495
496
497
# File 'lib/bitescript/mirror.rb', line 495

def visitExceptionType
  GenericTypeBuilder.new {|type| exception_types << type}
end

#visitFormalTypeParameter(name) ⇒ Object



475
476
477
# File 'lib/bitescript/mirror.rb', line 475

def visitFormalTypeParameter(name)
  type_parameters << TypeVariable.new(name)
end

#visitInterfaceObject



503
504
505
# File 'lib/bitescript/mirror.rb', line 503

def visitInterface
  GenericTypeBuilder.new {|type| interfaces << type}
end

#visitInterfaceBoundObject



483
484
485
# File 'lib/bitescript/mirror.rb', line 483

def visitInterfaceBound
  GenericTypeBuilder.new {|bound| type_parameters[-1].bounds << bound}
end

#visitParameterTypeObject



487
488
489
# File 'lib/bitescript/mirror.rb', line 487

def visitParameterType
  GenericTypeBuilder.new {|type| parameter_types << type}
end

#visitReturnTypeObject



491
492
493
# File 'lib/bitescript/mirror.rb', line 491

def visitReturnType
  GenericTypeBuilder.new {|type| @return_type = type}
end

#visitSuperclassObject



499
500
501
# File 'lib/bitescript/mirror.rb', line 499

def visitSuperclass
  GenericTypeBuilder.new {|type| @superclass = type}
end