ElixirScope.ASTRepository.FunctionData (elixir_scope v0.0.1)

Function-level data structure with static analysis and runtime correlation.

This structure stores comprehensive information about individual functions including:

  • Function AST and metadata
  • Static analysis results
  • Runtime execution data
  • Performance metrics
  • Error patterns

Summary

Functions

Adds a call pattern observation.

Adds a return pattern observation.

Calculates the error rate for this function.

Gets the AST node IDs for this function.

Gets the correlation IDs associated with this function.

Checks if this function has runtime execution data.

Checks if this function is considered a performance bottleneck.

Creates a new FunctionData structure from function AST.

Records an error event for this function.

Records a function execution event.

Updates the performance profile with new execution data.

Types

ast_node_id()

@type ast_node_id() :: binary()

correlation_id()

@type correlation_id() :: binary()

function_key()

@type function_key() :: {module_name(), function_name(), arity()}

function_name()

@type function_name() :: atom()

module_name()

@type module_name() :: atom()

t()

@type t() :: %ElixirScope.ASTRepository.FunctionData{
  annotations: term(),
  arity: term(),
  ast: term(),
  ast_node_mapping: term(),
  attributes: term(),
  call_patterns: term(),
  complexity_metrics: term(),
  correlation_metadata: term(),
  created_at: term(),
  dependencies: term(),
  documentation: term(),
  error_history: term(),
  execution_count: term(),
  execution_statistics: term(),
  first_execution: term(),
  function_key: term(),
  function_name: term(),
  guards: term(),
  hot_path_indicator: term(),
  instrumentation_points: term(),
  last_execution: term(),
  module_name: term(),
  performance_profile: term(),
  purity_analysis: term(),
  return_patterns: term(),
  side_effects: term(),
  source_location: term(),
  type: term(),
  type_signature: term(),
  updated_at: term(),
  version: term(),
  visibility: term()
}

Functions

add_call_pattern(function_data, call_pattern)

@spec add_call_pattern(t(), map()) :: t()

Adds a call pattern observation.

add_return_pattern(function_data, return_pattern)

@spec add_return_pattern(t(), map()) :: t()

Adds a return pattern observation.

error_rate(function_data)

@spec error_rate(t()) :: float()

Calculates the error rate for this function.

get_ast_node_ids(function_data)

@spec get_ast_node_ids(t()) :: [ast_node_id()]

Gets the AST node IDs for this function.

get_correlation_ids(function_data)

@spec get_correlation_ids(t()) :: [correlation_id()]

Gets the correlation IDs associated with this function.

has_runtime_data?(function_data)

@spec has_runtime_data?(t()) :: boolean()

Checks if this function has runtime execution data.

is_bottleneck?(function_data)

@spec is_bottleneck?(t()) :: boolean()

Checks if this function is considered a performance bottleneck.

new(function_key, ast, opts \\ [])

@spec new(function_key(), term(), keyword()) :: t()

Creates a new FunctionData structure from function AST.

Parameters

  • function_key - The {module, function, arity} tuple
  • ast - The function AST
  • opts - Optional parameters including source_location, visibility, etc.

record_error(function_data, error_event)

@spec record_error(t(), map()) :: t()

Records an error event for this function.

record_execution(function_data, execution_event)

@spec record_execution(t(), map()) :: t()

Records a function execution event.

update_performance_profile(function_data, execution_data)

@spec update_performance_profile(t(), map()) :: t()

Updates the performance profile with new execution data.