mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
cleanup after review
This commit is contained in:
parent
d7e66fa9a0
commit
97acf1363d
3 changed files with 2 additions and 55 deletions
|
@ -737,57 +737,6 @@ fn canonicalize_when_branch<'a>(
|
|||
)
|
||||
}
|
||||
|
||||
/*
|
||||
fn canonicalize_when_branch<'a>(
|
||||
env: &mut Env<'a>,
|
||||
var_store: &VarStore,
|
||||
scope: &Scope,
|
||||
region: Region,
|
||||
loc_pattern: &Located<ast::Pattern<'a>>,
|
||||
loc_expr: &'a Located<ast::Expr<'a>>,
|
||||
output: &mut Output,
|
||||
) -> (Located<Pattern>, Located<Expr>, References) {
|
||||
// Each case branch gets a new scope for canonicalization.
|
||||
// Shadow `scope` to make sure we don't accidentally use the original one for the
|
||||
// rest of this block, but keep the original around for later diffing.
|
||||
let original_scope = scope;
|
||||
let mut scope = original_scope.clone();
|
||||
|
||||
let loc_can_pattern = canonicalize_pattern(
|
||||
env,
|
||||
var_store,
|
||||
&mut scope,
|
||||
WhenBranch,
|
||||
&loc_pattern.value,
|
||||
loc_pattern.region,
|
||||
);
|
||||
|
||||
let (can_expr, branch_output) =
|
||||
canonicalize_expr(env, var_store, &mut scope, region, &loc_expr.value);
|
||||
|
||||
// If we already recorded a tail call then keep it, else use this branch's tail call
|
||||
match output.tail_call {
|
||||
Some(_) => {}
|
||||
None => output.tail_call = branch_output.tail_call,
|
||||
};
|
||||
|
||||
// Now that we've collected all the references for this branch, check to see if
|
||||
// any of the new idents it defined were unused. If any were, report it.
|
||||
for (symbol, region) in scope.symbols() {
|
||||
let symbol = *symbol;
|
||||
|
||||
if !output.references.has_lookup(symbol)
|
||||
&& !branch_output.references.has_lookup(symbol)
|
||||
&& !original_scope.contains_symbol(symbol)
|
||||
{
|
||||
env.problem(Problem::UnusedDef(symbol, *region));
|
||||
}
|
||||
}
|
||||
|
||||
(loc_can_pattern, can_expr, branch_output.references)
|
||||
}
|
||||
*/
|
||||
|
||||
pub fn local_successors<'a>(
|
||||
references: &'a References,
|
||||
closures: &'a MutMap<Symbol, References>,
|
||||
|
|
|
@ -1031,8 +1031,6 @@ fn from_can_when<'a>(
|
|||
for when_branch in branches {
|
||||
let mono_expr = from_can(env, when_branch.value.value, procs, None);
|
||||
|
||||
// let mono_patterns = Vec::with_capacity_in(when_branch.patterns.len(), env.arena);
|
||||
|
||||
for loc_pattern in when_branch.patterns {
|
||||
let mono_pattern = from_can_pattern(env, &loc_pattern.value);
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ impl<'a> Layout<'a> {
|
|||
true
|
||||
}
|
||||
Pointer(_) => {
|
||||
// TODO is this accurate?
|
||||
true
|
||||
// We cannot memcpy pointers, because then we would have the same pointer in multiple places!
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue