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.



505
506
507
508
509
510
511
512
513
514
515
# File 'lib/bitescript/mirror.rb', line 505

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.



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

def exception_types
  @exception_types
end

#interfacesObject (readonly)

Returns the value of attribute interfaces.



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

def interfaces
  @interfaces
end

#parameter_typesObject (readonly)

Returns the value of attribute parameter_types.



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

def parameter_types
  @parameter_types
end

#return_typeObject (readonly)

Returns the value of attribute return_type.



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

def return_type
  @return_type
end

#superclassObject (readonly)

Returns the value of attribute superclass.



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

def superclass
  @superclass
end

#type_parametersObject (readonly)

Returns the value of attribute type_parameters.



493
494
495
# File 'lib/bitescript/mirror.rb', line 493

def type_parameters
  @type_parameters
end

Instance Method Details

#class?Boolean

Returns:

  • (Boolean)


501
502
503
# File 'lib/bitescript/mirror.rb', line 501

def class?
  superclass != nil
end

#method?Boolean

Returns:

  • (Boolean)


497
498
499
# File 'lib/bitescript/mirror.rb', line 497

def method?
  return_type != nil
end

#visitClassBoundObject



521
522
523
# File 'lib/bitescript/mirror.rb', line 521

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

#visitExceptionTypeObject



537
538
539
# File 'lib/bitescript/mirror.rb', line 537

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

#visitFormalTypeParameter(name) ⇒ Object



517
518
519
# File 'lib/bitescript/mirror.rb', line 517

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

#visitInterfaceObject



545
546
547
# File 'lib/bitescript/mirror.rb', line 545

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

#visitInterfaceBoundObject



525
526
527
# File 'lib/bitescript/mirror.rb', line 525

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

#visitParameterTypeObject



529
530
531
# File 'lib/bitescript/mirror.rb', line 529

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

#visitReturnTypeObject



533
534
535
# File 'lib/bitescript/mirror.rb', line 533

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

#visitSuperclassObject



541
542
543
# File 'lib/bitescript/mirror.rb', line 541

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