Class: MilkTea::Diagnostic

Inherits:
Data
  • Object
show all
Defined in:
lib/milk_tea/base.rb

Overview

Unified diagnostic value shared by the linter, sema, and all ControlFlow analyses. severity: :error | :warning | :hint | :info

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, line:, column: nil, length: nil, code:, message:, severity: :warning, symbol_name: nil) ⇒ Diagnostic

Returns a new instance of Diagnostic.



46
# File 'lib/milk_tea/base.rb', line 46

def initialize(path:, line:, column: nil, length: nil, code:, message:, severity: :warning, symbol_name: nil) = super

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def code
  @code
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def column
  @column
end

#lengthObject (readonly)

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def length
  @length
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def path
  @path
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def severity
  @severity
end

#symbol_nameObject (readonly)

Returns the value of attribute symbol_name

Returns:

  • (Object)

    the current value of symbol_name



45
46
47
# File 'lib/milk_tea/base.rb', line 45

def symbol_name
  @symbol_name
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


48
# File 'lib/milk_tea/base.rb', line 48

def error?   = severity == :error

#hint?Boolean

Returns:

  • (Boolean)


50
# File 'lib/milk_tea/base.rb', line 50

def hint?    = severity == :hint

#info?Boolean

Returns:

  • (Boolean)


51
# File 'lib/milk_tea/base.rb', line 51

def info?    = severity == :info

#warning?Boolean

Returns:

  • (Boolean)


49
# File 'lib/milk_tea/base.rb', line 49

def warning? = severity == :warning