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.



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

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.



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

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



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

def line
  @line
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#codeObject



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

def code
  "lowering/internal"
end

#to_diagnostic(path: nil) ⇒ Object



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

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