Skip to content

Commit

Permalink
compact: Minor cleanups.
Browse files Browse the repository at this point in the history
- Simplify visibility markings.

- Remove some testing comments. (Tests carried out.)

- Remove some commented-out code.
  • Loading branch information
jimblandy authored and teoxoy committed Oct 9, 2023
1 parent c671603 commit e820c33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/compact/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ impl ModuleMap {
adjust(sampler);
adjust(coordinate);
operand_map.adjust_option(array_index);
// TEST: try adjusting this with plain operand_map
if let Some(ref mut offset) = *offset {
self.const_expressions.adjust(offset);
}
Expand Down
21 changes: 7 additions & 14 deletions src/compact/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use super::handle_set_map::HandleSet;
use super::{FunctionMap, ModuleMap};
use crate::arena::Handle;

pub(super) struct FunctionTracer<'a> {
pub(super) module: &'a crate::Module,
pub(super) function: &'a crate::Function,
pub struct FunctionTracer<'a> {
pub module: &'a crate::Module,
pub function: &'a crate::Function,

pub(super) types_used: &'a mut HandleSet<crate::Type>,
pub(super) constants_used: &'a mut HandleSet<crate::Constant>,
pub(super) const_expressions_used: &'a mut HandleSet<crate::Expression>,
pub types_used: &'a mut HandleSet<crate::Type>,
pub constants_used: &'a mut HandleSet<crate::Constant>,
pub const_expressions_used: &'a mut HandleSet<crate::Expression>,

/// Function-local expressions used.
pub(super) expressions_used: HandleSet<crate::Expression>,
pub expressions_used: HandleSet<crate::Expression>,
}

impl<'a> FunctionTracer<'a> {
Expand All @@ -27,7 +27,6 @@ impl<'a> FunctionTracer<'a> {
for (_, local) in self.function.local_variables.iter() {
self.trace_type(local.ty);
if let Some(init) = local.init {
// TEST: try changing this to trace_expression
self.trace_const_expression(init);
}
}
Expand Down Expand Up @@ -55,12 +54,6 @@ impl<'a> FunctionTracer<'a> {
.trace_expression(expr);
}

/*
pub fn trace_const_expression(&mut self, const_expr: Handle<crate::Expression>) {
self.as_expression().as_const_expression().trace_expression(const_expr);
}
*/

fn as_type(&mut self) -> super::types::TypeTracer {
super::types::TypeTracer {
types: &self.module.types,
Expand Down

0 comments on commit e820c33

Please sign in to comment.