Skip to main contentModule cache_array_length
Source use super::CacheArrayLength; ๐ use crate::linter::LateLintPass; ๐ use crate::linter::LintContext; ๐ use crate::sol::Severity; ๐ use crate::sol::SolLint; ๐ use crate::sol::analysis::for_each_lhs_var; ๐ use solar::ast::ElementaryType; ๐ use solar::interface::Span; ๐ use solar::interface::data_structures::Never; ๐ use solar::interface::sym; ๐ use solar::sema::Gcx; ๐ use solar::sema::builtins::Builtin; ๐ use solar::sema::hir; ๐ use solar::sema::hir::BinOpKind; ๐ use solar::sema::hir::Expr; ๐ use solar::sema::hir::ExprKind; ๐ use solar::sema::hir::LoopSource; ๐ use solar::sema::hir::StateMutability; ๐ use solar::sema::hir::Stmt; ๐ use solar::sema::hir::StmtKind; ๐ use solar::sema::hir::VariableId; ๐ use solar::sema::hir::Visit as _; ๐ use solar::sema::ty::TyKind; ๐ use std::ops::ControlFlow; ๐
- LoopFacts ๐
- Loop body facts that make caching unsafe: variables written, array length mutations and
calls that may mutate state.
- CACHE_ARRAY_LENGTH
- call_may_mutate_state ๐
- Whether a call may write storage; array
push/pop count since they change the length. - collect_length_reads ๐
- Collects
<state dynamic array>.length reads compared against an identifier in expr. - is_array_like ๐
- state_dyn_array ๐
- The state variable
expr names, if it is a dynamic array.