Exception: JsxRosetta::IR::Lowering::LoweringError

Inherits:
Error
  • Object
show all
Defined in:
lib/jsx_rosetta/ir/lowering.rb

Overview

A failure during AST → IR lowering. Carries optional line/column information when the failure can be tied to an AST node.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, node: nil, source: nil) ⇒ LoweringError

Returns a new instance of LoweringError.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/jsx_rosetta/ir/lowering.rb', line 33

def initialize(message, node: nil, source: nil)
  @line = nil
  @column = nil

  if node && source && node.start_pos
    @line, @column = compute_line_column(source, node.start_pos)
    message = "#{message} (at line #{@line}, column #{@column})"
  end

  super(message)
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



31
32
33
# File 'lib/jsx_rosetta/ir/lowering.rb', line 31

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



31
32
33
# File 'lib/jsx_rosetta/ir/lowering.rb', line 31

def line
  @line
end