Class: Rigor::Scope::DiscoveryIndex

Inherits:
Data
  • Object
show all
Defined in:
lib/rigor/scope/discovery_index.rb,
lib/rigor/scope/discovery_index.rb,
sig/rigor/scope.rbs

Overview

ADR-53 Track A — the seed-time discovery context every Scope snapshot carries by a single reference. Holds the tables the index-time pre-passes (Inference::ScopeIndexer per file, plus the cross-file project pre-pass) populate and that no control-flow transition ever varies: Scope#== ignores them and Scope#join copies them from the receiver unexamined, which is the membership litmus the ADR fixes.

Immutable (Data instances are frozen); deriving a seeded index goes through #with(table_name: table). Scope exposes each table through its existing reader surface, so engine call sites and plugins are unaffected by the extraction.

Constant Summary collapse

EMPTY =

The shared all-empty index Scope.empty (and every scope that never sees a seeding pass) points at — one allocation per process.

Returns:

new(
  declared_types: EMPTY_NODE_TABLE,
  class_ivars: EMPTY_TABLE,
  class_cvars: EMPTY_TABLE,
  program_globals: EMPTY_TABLE,
  discovered_classes: EMPTY_TABLE,
  in_source_constants: EMPTY_TABLE,
  discovered_methods: EMPTY_TABLE,
  discovered_def_nodes: EMPTY_TABLE,
  discovered_singleton_def_nodes: EMPTY_TABLE,
  discovered_def_sources: EMPTY_TABLE,
  discovered_method_visibilities: EMPTY_TABLE,
  discovered_superclasses: EMPTY_TABLE,
  discovered_includes: EMPTY_TABLE,
  discovered_class_sources: EMPTY_TABLE,
  data_member_layouts: EMPTY_TABLE,
  struct_member_layouts: EMPTY_TABLE,
  # ADR-67 WD3 — the call-site parameter-inference table, keyed by `[class_name, method_name, kind]` (the
  # same `(class, method, kind)` triple {Inference::ParameterInferenceCollector} records and that
  # `build_method_entry_scope` reconstructs from the lexical class path). The value is a
  # `{param_name(Symbol) => Rigor::Type}` map of the union of resolved call-site argument types. Empty on
  # every normal run; only the `coverage --protection` collection pass populates it today, so a `check` run
  # leaves it empty and seeds nothing (byte-identical).
  param_inferred_types: EMPTY_TABLE
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#class_cvarsObject (readonly)

Returns the value of attribute class_cvars

Returns:

  • (Object)

    the current value of class_cvars



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def class_cvars
  @class_cvars
end

#class_ivarsObject (readonly)

Returns the value of attribute class_ivars

Returns:

  • (Object)

    the current value of class_ivars



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def class_ivars
  @class_ivars
end

#data_member_layoutsObject (readonly)

Returns the value of attribute data_member_layouts

Returns:

  • (Object)

    the current value of data_member_layouts



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def data_member_layouts
  @data_member_layouts
end

#declared_typesObject (readonly)

Returns the value of attribute declared_types

Returns:

  • (Object)

    the current value of declared_types



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def declared_types
  @declared_types
end

#discovered_class_sourcesObject (readonly)

Returns the value of attribute discovered_class_sources

Returns:

  • (Object)

    the current value of discovered_class_sources



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_class_sources
  @discovered_class_sources
end

#discovered_classesObject (readonly)

Returns the value of attribute discovered_classes

Returns:

  • (Object)

    the current value of discovered_classes



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_classes
  @discovered_classes
end

#discovered_def_nodesObject (readonly)

Returns the value of attribute discovered_def_nodes

Returns:

  • (Object)

    the current value of discovered_def_nodes



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_def_nodes
  @discovered_def_nodes
end

#discovered_def_sourcesObject (readonly)

Returns the value of attribute discovered_def_sources

Returns:

  • (Object)

    the current value of discovered_def_sources



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_def_sources
  @discovered_def_sources
end

#discovered_includesObject (readonly)

Returns the value of attribute discovered_includes

Returns:

  • (Object)

    the current value of discovered_includes



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_includes
  @discovered_includes
end

#discovered_method_visibilitiesObject (readonly)

Returns the value of attribute discovered_method_visibilities

Returns:

  • (Object)

    the current value of discovered_method_visibilities



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_method_visibilities
  @discovered_method_visibilities
end

#discovered_methodsObject (readonly)

Returns the value of attribute discovered_methods

Returns:

  • (Object)

    the current value of discovered_methods



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_methods
  @discovered_methods
end

#discovered_singleton_def_nodesObject (readonly)

Returns the value of attribute discovered_singleton_def_nodes

Returns:

  • (Object)

    the current value of discovered_singleton_def_nodes



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_singleton_def_nodes
  @discovered_singleton_def_nodes
end

#discovered_superclassesObject (readonly)

Returns the value of attribute discovered_superclasses

Returns:

  • (Object)

    the current value of discovered_superclasses



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def discovered_superclasses
  @discovered_superclasses
end

#in_source_constantsObject (readonly)

Returns the value of attribute in_source_constants

Returns:

  • (Object)

    the current value of in_source_constants



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def in_source_constants
  @in_source_constants
end

#param_inferred_typesObject (readonly)

Returns the value of attribute param_inferred_types

Returns:

  • (Object)

    the current value of param_inferred_types



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def param_inferred_types
  @param_inferred_types
end

#program_globalsObject (readonly)

Returns the value of attribute program_globals

Returns:

  • (Object)

    the current value of program_globals



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def program_globals
  @program_globals
end

#struct_member_layoutsObject (readonly)

Returns the value of attribute struct_member_layouts

Returns:

  • (Object)

    the current value of struct_member_layouts



13
14
15
# File 'lib/rigor/scope/discovery_index.rb', line 13

def struct_member_layouts
  @struct_member_layouts
end

Instance Method Details

#withDiscoveryIndex

Parameters:

  • declared_types: (Hash[untyped, Type::t])
  • class_ivars: (Hash[String, Hash[Symbol, Type::t]])
  • class_cvars: (Hash[String, Hash[Symbol, Type::t]])
  • program_globals: (Hash[Symbol, Type::t])
  • discovered_classes: (Hash[String, Type::Singleton])
  • in_source_constants: (Hash[String, Type::t])
  • discovered_methods: (Hash[String, Hash[Symbol, Symbol]])
  • discovered_def_nodes: (Hash[String, Hash[Symbol, untyped]])
  • discovered_singleton_def_nodes: (Hash[String, Hash[Symbol, untyped]])
  • discovered_def_sources: (Hash[String, Hash[Symbol, String]])
  • discovered_method_visibilities: (Hash[String, Hash[Symbol, Symbol]])
  • discovered_superclasses: (Hash[String, String])
  • discovered_includes: (Hash[String, Array[String]])
  • discovered_class_sources: (Hash[String, Set[String]])
  • data_member_layouts: (Hash[String, Array[Symbol]])
  • struct_member_layouts: (Hash[String, { members: Array[Symbol], keyword_init: bool }])
  • param_inferred_types: (Hash[[String, Symbol, Symbol], Hash[Symbol, Type::t]])

Returns:



61
# File 'sig/rigor/scope.rbs', line 61

def with: (?declared_types: Hash[untyped, Type::t], ?class_ivars: Hash[String, Hash[Symbol, Type::t]], ?class_cvars: Hash[String, Hash[Symbol, Type::t]], ?program_globals: Hash[Symbol, Type::t], ?discovered_classes: Hash[String, Type::Singleton], ?in_source_constants: Hash[String, Type::t], ?discovered_methods: Hash[String, Hash[Symbol, Symbol]], ?discovered_def_nodes: Hash[String, Hash[Symbol, untyped]], ?discovered_singleton_def_nodes: Hash[String, Hash[Symbol, untyped]], ?discovered_def_sources: Hash[String, Hash[Symbol, String]], ?discovered_method_visibilities: Hash[String, Hash[Symbol, Symbol]], ?discovered_superclasses: Hash[String, String], ?discovered_includes: Hash[String, Array[String]], ?discovered_class_sources: Hash[String, Set[String]], ?data_member_layouts: Hash[String, Array[Symbol]], ?struct_member_layouts: Hash[String, { members: Array[Symbol], keyword_init: bool }], ?param_inferred_types: Hash[[String, Symbol, Symbol], Hash[Symbol, Type::t]]) -> DiscoveryIndex