From c6716033da62bf2038c0ba2460e893a8a928b6d3 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 5 Oct 2023 18:15:26 -0700 Subject: [PATCH] Improve docs for `FunctionInfo::process_expression`. --- src/valid/analyzer.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/valid/analyzer.rs b/src/valid/analyzer.rs index 72d898b634..0ed707c1e3 100644 --- a/src/valid/analyzer.rs +++ b/src/valid/analyzer.rs @@ -421,8 +421,25 @@ impl FunctionInfo { }) } - /// Computes the expression info and stores it in `self.expressions`. - /// Also, bumps the reference counts on dependent expressions. + /// Compute the [`ExpressionInfo`] for `handle`. + /// + /// Replace the dummy entry in [`self.expressions`] for `handle` + /// with a real `ExpressionInfo` value describing that expression. + /// + /// This function is called as part of a forward sweep through the + /// arena, so we can assume that all earlier expressions in the + /// arena already have valid info. Since expressions only depend + /// on earlier expressions, this includes all our subexpressions. + /// + /// Adjust the reference counts on all expressions we use. + /// + /// Also populate the [`sampling_set`], [`sampling`] and + /// [`global_uses`] fields of `self`. + /// + /// [`self.expressions`]: FunctionInfo::expressions + /// [`sampling_set`]: FunctionInfo::sampling_set + /// [`sampling`]: FunctionInfo::sampling + /// [`global_uses`]: FunctionInfo::global_uses #[allow(clippy::or_fun_call)] fn process_expression( &mut self,