and remove everything because it has no effect

This commit is contained in:
Folkert 2022-03-21 23:07:27 +01:00
parent 1b1a7b0385
commit cee1a787c9
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 0 additions and 127 deletions

View file

@ -1147,92 +1147,6 @@ fn call_successors(call_symbol: Symbol, closures: &MutMap<Symbol, References>) -
answer
}
#[derive(Debug)]
enum ReferencesFrom {
Local(Symbol),
Call(Symbol),
}
pub(crate) fn references_from<'a, T>(
locals: impl IntoIterator<Item = Symbol>,
calls: impl IntoIterator<Item = Symbol>,
refs_by_def: &'a MutMap<Symbol, (T, References)>,
closures: &'a MutMap<Symbol, References>,
) -> References
where
T: Debug,
{
let mut stack = Vec::new();
stack.extend(locals.into_iter().map(ReferencesFrom::Local));
stack.extend(calls.into_iter().map(ReferencesFrom::Call));
references_from_help(stack, refs_by_def, closures)
}
fn references_from_help<'a, T>(
mut stack: Vec<ReferencesFrom>,
refs_by_def: &'a MutMap<Symbol, (T, References)>,
closures: &'a MutMap<Symbol, References>,
) -> References
where
T: Debug,
{
let mut visited = Vec::new();
let mut result = References::default();
while let Some(job) = stack.pop() {
match job {
ReferencesFrom::Local(defined_symbol) => {
if let Some((_, refs)) = refs_by_def.get(&defined_symbol) {
if visited.contains(&defined_symbol) {
continue;
}
visited.push(defined_symbol);
for local in refs.value_lookups.iter() {
stack.push(ReferencesFrom::Local(*local));
result.value_lookups.insert(*local);
}
for call in refs.calls.iter() {
stack.push(ReferencesFrom::Call(*call));
result.calls.insert(*call);
}
}
}
ReferencesFrom::Call(call_symbol) => {
if let Some(references) = closures.get(&call_symbol) {
if visited.contains(&call_symbol) {
continue;
}
visited.push(call_symbol);
result = result.union(references.clone());
for closed_over_local in references.value_lookups.iter() {
stack.push(ReferencesFrom::Local(*closed_over_local));
result.value_lookups.insert(*closed_over_local);
}
for call in references.calls.iter() {
stack.push(ReferencesFrom::Call(*call));
result.calls.insert(*call);
}
}
}
}
}
result
}
enum CanonicalizeRecordProblem {
InvalidOptionalValue {
field_name: Lowercase,