Skip to main content

Module dead_code_facts

Module dead_code_facts 

Source
Expand description

Per-file syntax facts persisted in content records and consumed by inspect.

Structs§

FactParsers
FileAnalysis
GoDispatchFacts
GoMethodFact
MacroTokenRefContribution
RawImportContribution
RawReexportContribution
ReexportSpecifier
RustApiFacts
RustApiItem
RustApiModule
RustApiUse
RustCfgTestRange
RustInitializer
RustMacroToken
RustReexportSpecifier
StoredFileFacts
What dead-code analysis reads from one file’s syntax tree, recorded once per content when the data layer parses the file, so an analysis reads it from the file’s content record instead of parsing again.
StoredJsFacts
A JavaScript or TypeScript file’s imports and re-exports, read when the Oxc engine has no facts for the file.
StoredRustFacts
A Rust file’s facts.

Enums§

RustCfgTestModule
An out-of-line module a file declares under #[cfg(test)], by the #[path] it gives or by its name.

Constants§

MAX_RUST_API_NESTING
How many modules and item macros rust_collect_api_facts descends through, counted together. Real code nests a handful; past the bound the items are left undescribed rather than recursing further, because each level costs a stack frame (a stack overflow aborts the process) and copies the module path, so a file of thousands of nested modules would otherwise take quadratic time and memory.
MAX_RUST_USE_GROUP_NESTING
How deep rust_api_use_paths follows nested {...} groups of one use declaration. Real code nests a few; deeper groups are dropped rather than recursed into, because each level costs a stack frame (a stack overflow aborts the process) and copies the path prefix and the group’s text, so thousands of levels would take quadratic time and memory.
RUST_MACRO_REF_SHAPE_CALL
RUST_MACRO_REF_SHAPE_METHOD
RUST_MACRO_REF_SHAPE_STRUCT
TOP_LEVEL_SYMBOL

Functions§

cfg_predicate_requires_test
collect_rust_macro_token_refs
Adds to refs the references the macro invocations under root make through their tokens, each attributed to the function around it (the innermost of scope_stack and the function items above the invocation).
collect_rust_macro_tokens
Appends the leaf tokens under root to tokens, in source order, skipping the subtrees rust_macro_token_node_is_opaque names. The walk keeps its place in a tree cursor rather than recursing, so deeply nested token trees cannot overflow the stack.
export_source_module
extract_rust_macro_token_refs
find_child_by_kind
The first node of kind kind below node, in source order (node itself excluded). The search keeps its place in a tree cursor rather than recursing, so a deeply nested file cannot overflow the stack, which would abort the process.
go_dispatch_facts
go_method_signature
go_module_dir
The directory of the Go module the file at file (relative_file from the project root) belongs to, relative to the root: the nearest directory above it holding a go.mod, or the root’s own when none does.
go_signature_types
macro_ref_path
macro_scoped_symbol
node_text
normalize_relative_segments
Resolves . and .. segments of a project-relative path textually.
raw_imports_from_tree
rust_api_facts
rust_api_macro_expansion
rust_api_type_path
rust_api_use_paths
rust_api_use_paths_at
rust_api_use_paths for text, nested depth groups deep.
rust_attribute_requires_test
Whether attribute is #[cfg(...)] with a predicate requiring test.
rust_cfg_test_module_files_for
The project-relative candidate files of modules, declared in the file at relative_file.
rust_cfg_test_modules
The file-level #[cfg(test)] out-of-line module declarations of a file, in source order.
rust_cfg_test_ranges
Line ranges compiled only for tests: #[cfg(test)] items (modules, functions, impls, types, traits, constants and statics), plus #[cfg(test)] statements, blocks and nested items inside a function body. Calls on these lines are test usage, and declarations on them are test code.
rust_children_cfg_test_gated
parent’s named children, each with whether rust_node_has_cfg_test_attribute holds for it, worked out in one pass over the children. Asking each child separately walks back over every comment before it, which is quadratic in a file of many comment lines.
rust_collect_api_facts
Adds to facts the modules, uses and items declared directly in root and, through module bodies and item macros, below it. depth is how many modules and item macros enclose root.
rust_collect_api_macro_items
rust_collect_api_macro_text
rust_function_body_calls
Calls that run when this Rust function body runs.
rust_function_declaration_list_owner
rust_function_symbol_name
rust_globs_parent_module
Whether the file has a file-level use super::*; (the import parser keeps no record of glob imports, so this reads the syntax tree directly).
rust_impl_scope_name
rust_item_start_line
rust_macro_name_is_upper_camel
rust_macro_next_after_optional_turbofish
rust_macro_path_before
rust_macro_text_is_identifier
rust_macro_token_is_identifier
rust_macro_token_is_keyword
rust_macro_token_is_path_segment
rust_macro_token_node_is_opaque
rust_macro_token_refs
rust_mod_scope_chain
rust_module_file
The project-relative file of the out-of-line module at nested (its module path inside the declaring file), declared in the file at file, with path_override from its #[path] attribute.
rust_node_has_cfg_test_attribute
rust_normalize_module_path
rust_path_attribute_value
The string value of a #[path = "../../../aft/src/parser/..."] attribute attached to node.
rust_path_segments
rust_pub_use_statements
rust_qualified_item_name
rust_raw_import_contributions
rust_raw_reexport_contributions
rust_reexport_specifier
rust_reexport_specifiers
rust_serde_function_references
Functions named by serde field attributes (deserialize_with = "f", serialize_with, default, skip_serializing_if). serde calls them from derived code the callgraph never sees, so they are liveness roots. Each root is the declaration identity the path names from the attribute’s module, so "parse" inside mod config roots config::parse (see rust_serde_root_identity).
rust_serde_root_identity
The declaration identity a serde callback path names from module scope. helpers::parse inside mod config is config::helpers::parse; a leading self, super or crate fixes the starting module. A relative path that is not declared in scope is looked up in each enclosing module in turn, as a use super::... import usually brings it from there, and a bare name declared exactly once in the file resolves to that declaration. A path that names no declaration in this file keeps only its last segment.
rust_template_token_tree
The token_tree node spanning exactly start..end, including its delimiters. Templates nested in another template are token trees of the outer one, so they are found the same way.
rust_token_tree_invokes_metavariable_macro
Whether a template token tree, at any depth, invokes a macro named by a metavariable: a $name token followed by !, with comments and whitespace allowed in between, as in $callback /* note */ !(..).
rust_trait_impl_methods
Names of the methods defined inside impl Trait for Type blocks anywhere in the file (including inline modules).
rust_unrestricted_pub
split_cfg_predicates
string_literal_content
supports_type_refs
ts_namespace_reexport_name
ts_raw_reexport_contributions
ts_reexport_specifiers