Class: Udb::InstructionSubtype::Opcode
- Inherits:
-
Object
- Object
- Udb::InstructionSubtype::Opcode
- Extended by:
- T::Sig
- Defined in:
- lib/udb/obj/instruction.rb
Direct Known Subclasses
Instance Attribute Summary collapse
- #name ⇒ String readonly
- #range ⇒ Range readonly
Instance Method Summary collapse
- #initialize(name, range) constructor
- #overlaps?(other) ⇒ Boolean
Constructor Details
#initialize(name, range)
43 44 45 46 |
# File 'lib/udb/obj/instruction.rb', line 43 def initialize(name, range) @name = name @range = range end |
Instance Attribute Details
#name ⇒ String (readonly)
37 38 39 |
# File 'lib/udb/obj/instruction.rb', line 37 def name @name end |
#range ⇒ Range (readonly)
40 41 42 |
# File 'lib/udb/obj/instruction.rb', line 40 def range @range end |
Instance Method Details
#overlaps?(other) ⇒ Boolean
49 50 51 52 53 54 55 |
# File 'lib/udb/obj/instruction.rb', line 49 def overlaps?(other) if other.is_a?(Opcode) range.eql?(other.range) || range.cover?(other.range.first) || other.range.cover?(range.first) else other.location_bits.any? { |i| range.cover?(i) } end end |