Class: Ibex::IR::UserCodeChunk
- Inherits:
-
Object
- Object
- Ibex::IR::UserCodeChunk
- Defined in:
- lib/ibex/ir/grammar_ir.rb,
sig/ibex/ir/grammar_ir.rbs
Overview
One opaque user-code block and the location of its first code line.
Instance Attribute Summary collapse
- #code ⇒ String readonly
- #location ⇒ location readonly
Instance Method Summary collapse
-
#initialize(code:, location:) ⇒ UserCodeChunk
constructor
A new instance of UserCodeChunk.
- #to_h ⇒ Hash[Symbol, Object?]
Constructor Details
#initialize(code:, location:) ⇒ UserCodeChunk
Returns a new instance of UserCodeChunk.
145 146 147 148 149 |
# File 'lib/ibex/ir/grammar_ir.rb', line 145 def initialize(code:, location:) @code = code.freeze @location = IR.deep_freeze(location) freeze end |
Instance Attribute Details
#code ⇒ String (readonly)
141 142 143 |
# File 'lib/ibex/ir/grammar_ir.rb', line 141 def code @code end |
#location ⇒ location (readonly)
142 143 144 |
# File 'lib/ibex/ir/grammar_ir.rb', line 142 def location @location end |
Instance Method Details
#to_h ⇒ Hash[Symbol, Object?]
152 153 154 |
# File 'lib/ibex/ir/grammar_ir.rb', line 152 def to_h { code: @code, loc: @location } end |