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.



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

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



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

def code
  @code
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



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

def column
  @column
end

#lengthObject (readonly)

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



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

def length
  @length
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



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

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



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

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



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

def path
  @path
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



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

def severity
  @severity
end

#symbol_nameObject (readonly)

Returns the value of attribute symbol_name

Returns:

  • (Object)

    the current value of symbol_name



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

def symbol_name
  @symbol_name
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


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

def error?   = severity == :error

#hint?Boolean

Returns:

  • (Boolean)


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

def hint?    = severity == :hint

#info?Boolean

Returns:

  • (Boolean)


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

def info?    = severity == :info

#warning?Boolean

Returns:

  • (Boolean)


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

def warning? = severity == :warning