Class: Ibex::IR::UserCodeChunk

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(code:, location:) ⇒ UserCodeChunk

Returns a new instance of UserCodeChunk.

RBS:

  • (code: String, location: location) -> void

Parameters:



142
143
144
145
146
# File 'lib/ibex/ir/grammar_ir.rb', line 142

def initialize(code:, location:)
  @code = code.freeze
  @location = IR.deep_freeze(location)
  freeze
end

Instance Attribute Details

#codeString (readonly)

Signature:

  • String

Returns:

  • (String)


138
139
140
# File 'lib/ibex/ir/grammar_ir.rb', line 138

def code
  @code
end

#locationlocation (readonly)

Signature:

  • location

Returns:



139
140
141
# File 'lib/ibex/ir/grammar_ir.rb', line 139

def location
  @location
end

Instance Method Details

#to_hHash[Symbol, untyped]

RBS:

  • () -> Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


149
150
151
# File 'lib/ibex/ir/grammar_ir.rb', line 149

def to_h
  { code: @code, loc: @location }
end