Class: MilkTea::DebugMap::Function

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



22
23
24
# File 'lib/milk_tea/tooling/debug_map.rb', line 22

def line
  @line
end

#linkage_nameObject (readonly)

Returns the value of attribute linkage_name

Returns:

  • (Object)

    the current value of linkage_name



22
23
24
# File 'lib/milk_tea/tooling/debug_map.rb', line 22

def linkage_name
  @linkage_name
end

#localsObject (readonly)

Returns the value of attribute locals

Returns:

  • (Object)

    the current value of locals



22
23
24
# File 'lib/milk_tea/tooling/debug_map.rb', line 22

def locals
  @locals
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



22
23
24
# File 'lib/milk_tea/tooling/debug_map.rb', line 22

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params

Returns:

  • (Object)

    the current value of params



22
23
24
# File 'lib/milk_tea/tooling/debug_map.rb', line 22

def params
  @params
end

#source_pathObject (readonly)

Returns the value of attribute source_path

Returns:

  • (Object)

    the current value of source_path



22
23
24
# File 'lib/milk_tea/tooling/debug_map.rb', line 22

def source_path
  @source_path
end

Instance Method Details

#to_h(base_dir: nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/milk_tea/tooling/debug_map.rb', line 23

def to_h(base_dir: nil)
  payload = {
    "name" => name,
    "cName" => linkage_name,
    "params" => params.map(&:to_h),
    "locals" => locals.map(&:to_h),
  }
  serialized_source_path = DebugMap.path_for_payload(source_path, base_dir)
  payload["sourcePath"] = serialized_source_path if serialized_source_path
  payload["line"] = line if line
  payload
end