Revert "toplevel debug"

This reverts commit 5ea8d96f3e.
This commit is contained in:
Folkert 2022-11-23 20:29:55 +01:00
parent 5ea8d96f3e
commit dcb530d3af
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
5 changed files with 10 additions and 70 deletions

View file

@ -1600,25 +1600,6 @@ pub(crate) fn sort_can_defs_new(
declarations.push_expect_fx(preceding_comment, name, Loc::at(region, condition));
}
let it = dbgs
.conditions
.into_iter()
.zip(dbgs.regions)
.zip(dbgs.preceding_comment);
for ((condition, region), preceding_comment) in it {
// an `dbg` does not have a user-defined name, but we'll need a name to call the function we generate
let name = scope.gen_unique_symbol();
let variable = var_store.fresh();
declarations.push_dbg(
preceding_comment,
name,
variable,
Loc::at(region, condition),
);
}
for (symbol, alias) in aliases.into_iter() {
output.aliases.insert(symbol, alias);
}

View file

@ -2398,25 +2398,6 @@ impl Declarations {
index
}
pub fn push_dbg(
&mut self,
preceding_comment: Region,
name: Symbol,
variable: Variable,
loc_expr: Loc<Expr>,
) -> usize {
let index = self.declarations.len();
self.declarations.push(DeclarationTag::Dbg);
self.variables.push(variable);
self.symbols.push(Loc::at(preceding_comment, name));
self.annotations.push(None);
self.expressions.push(loc_expr);
index
}
pub fn push_value_def(
&mut self,
symbol: Loc<Symbol>,
@ -2591,10 +2572,6 @@ impl Declarations {
MutualRecursion { .. } => {
// the self of this group will be treaded individually by later iterations
}
Dbg => {
let loc_expr = &self.expressions[index];
collector.visit_expr(&loc_expr.value, loc_expr.region, var);
}
Expectation => {
let loc_expr =
toplevel_expect_to_inline_expect_pure(self.expressions[index].clone());
@ -2621,7 +2598,6 @@ pub enum DeclarationTag {
Value,
Expectation,
ExpectationFx,
Dbg,
Function(Index<Loc<FunctionDef>>),
Recursive(Index<Loc<FunctionDef>>),
TailRecursive(Index<Loc<FunctionDef>>),
@ -2639,7 +2615,7 @@ impl DeclarationTag {
match self {
Function(_) | Recursive(_) | TailRecursive(_) => 1,
Value => 1,
Expectation | ExpectationFx | Dbg => 1,
Expectation | ExpectationFx => 1,
Destructure(_) => 1,
MutualRecursion { length, .. } => length as usize + 1,
}

View file

@ -615,7 +615,6 @@ pub fn canonicalize_module_defs<'a>(
}
Expectation => { /* ignore */ }
ExpectationFx => { /* ignore */ }
Dbg => { /* ignore */ }
}
}
@ -758,7 +757,15 @@ pub fn canonicalize_module_defs<'a>(
MutualRecursion { .. } => {
// the declarations of this group will be treaded individually by later iterations
}
Expectation | ExpectationFx | Dbg => {
Expectation => {
let loc_expr = &mut declarations.expressions[index];
fix_values_captured_in_closure_expr(
&mut loc_expr.value,
&mut fix_closures_no_capture_symbols,
&mut fix_closures_closure_captures,
);
}
ExpectationFx => {
let loc_expr = &mut declarations.expressions[index];
fix_values_captured_in_closure_expr(
&mut loc_expr.value,

View file

@ -57,12 +57,6 @@ pub fn walk_decls<V: Visitor>(visitor: &mut V, decls: &Declarations) {
visitor.visit_expr(&loc_condition.value, loc_condition.region, Variable::BOOL);
}
Dbg => {
let loc_condition = &decls.expressions[index];
let expr_var = decls.variables[index];
visitor.visit_expr(&loc_condition.value, loc_condition.region, expr_var);
}
Function(function_index)
| Recursive(function_index)
| TailRecursive(function_index) => {