Exception: MilkTea::LoweringError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/milk_tea/core/lowering.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, line: nil, column: nil, path: nil) ⇒ LoweringError

Returns a new instance of LoweringError.



52
53
54
55
56
57
# File 'lib/milk_tea/core/lowering.rb', line 52

def initialize(msg = nil, line: nil, column: nil, path: nil)
  super(msg)
  @line = line
  @column = column
  @path = path
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



50
51
52
# File 'lib/milk_tea/core/lowering.rb', line 50

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



50
51
52
# File 'lib/milk_tea/core/lowering.rb', line 50

def line
  @line
end

#pathObject (readonly)

Returns the value of attribute path.



50
51
52
# File 'lib/milk_tea/core/lowering.rb', line 50

def path
  @path
end

Instance Method Details

#codeObject



59
60
61
# File 'lib/milk_tea/core/lowering.rb', line 59

def code
  "lowering/internal"
end

#to_diagnostic(path: nil) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/milk_tea/core/lowering.rb', line 63

def to_diagnostic(path: nil)
  Diagnostic.new(
    path: @path || path,
    line: @line,
    column: @column,
    length: nil,
    code: code,
    message: message,
    severity: :error,
  )
end