class Mirrors::ReferencesVisitor
ReferencesVisitor
examines opcodes and records references to classes, methods, and fields
Attributes
markers[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/mirrors/visitors/references_visitor.rb, line 11 def initialize super @markers = [] end
Protected Instance Methods
visit(bytecode)
click to toggle source
# File lib/mirrors/visitors/references_visitor.rb, line 18 def visit(bytecode) case bytecode.first when :getinstancevariable @markers << field_marker(bytecode[1]) when :getconstant @markers << class_marker(bytecode.last) when :opt_send_without_block @markers << method_marker(bytecode[1][:mid]) end end
Private Instance Methods
class_marker(name)
click to toggle source
# File lib/mirrors/visitors/references_visitor.rb, line 31 def class_marker(name) Marker.new( type: Mirrors::Marker::TYPE_CLASS_REFERENCE, message: name, file: @absolute_path, line: @line ) end
field_marker(name)
click to toggle source
# File lib/mirrors/visitors/references_visitor.rb, line 40 def field_marker(name) Marker.new( type: Mirrors::Marker::TYPE_FIELD_REFERENCE, message: name, file: @absolute_path, line: @line ) end
method_marker(name)
click to toggle source
# File lib/mirrors/visitors/references_visitor.rb, line 49 def method_marker(name) Marker.new( type: Mirrors::Marker::TYPE_METHOD_REFERENCE, message: name, file: @absolute_path, line: @line ) end