mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Remove aliases in partial procs
This is no longer needed
This commit is contained in:
parent
1beb00f490
commit
52c858dc53
1 changed files with 1 additions and 31 deletions
|
@ -132,11 +132,6 @@ pub struct PartialProcs<'a> {
|
||||||
/// maps a function name (symbol) to an index
|
/// maps a function name (symbol) to an index
|
||||||
symbols: Vec<'a, Symbol>,
|
symbols: Vec<'a, Symbol>,
|
||||||
|
|
||||||
/// An entry (a, b) means `a` directly references the lambda value of `b`,
|
|
||||||
/// i.e. this came from a `let a = b in ...` where `b` was defined as a
|
|
||||||
/// lambda earlier.
|
|
||||||
references: Vec<'a, (Symbol, Symbol)>,
|
|
||||||
|
|
||||||
partial_procs: Vec<'a, PartialProc<'a>>,
|
partial_procs: Vec<'a, PartialProc<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +139,6 @@ impl<'a> PartialProcs<'a> {
|
||||||
fn new_in(arena: &'a Bump) -> Self {
|
fn new_in(arena: &'a Bump) -> Self {
|
||||||
Self {
|
Self {
|
||||||
symbols: Vec::new_in(arena),
|
symbols: Vec::new_in(arena),
|
||||||
references: Vec::new_in(arena),
|
|
||||||
partial_procs: Vec::new_in(arena),
|
partial_procs: Vec::new_in(arena),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,16 +146,7 @@ impl<'a> PartialProcs<'a> {
|
||||||
self.symbol_to_id(symbol).is_some()
|
self.symbol_to_id(symbol).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn symbol_to_id(&self, mut symbol: Symbol) -> Option<PartialProcId> {
|
fn symbol_to_id(&self, symbol: Symbol) -> Option<PartialProcId> {
|
||||||
while let Some(real_symbol) = self
|
|
||||||
.references
|
|
||||||
.iter()
|
|
||||||
.find(|(alias, _)| *alias == symbol)
|
|
||||||
.map(|(_, real)| real)
|
|
||||||
{
|
|
||||||
symbol = *real_symbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.symbols
|
self.symbols
|
||||||
.iter()
|
.iter()
|
||||||
.position(|s| *s == symbol)
|
.position(|s| *s == symbol)
|
||||||
|
@ -193,21 +178,6 @@ impl<'a> PartialProcs<'a> {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_alias(&mut self, alias: Symbol, real_symbol: Symbol) {
|
|
||||||
debug_assert!(
|
|
||||||
!self.contains_key(alias),
|
|
||||||
"{:?} is inserted as a partial proc twice: that's a bug!",
|
|
||||||
alias,
|
|
||||||
);
|
|
||||||
debug_assert!(
|
|
||||||
self.contains_key(real_symbol),
|
|
||||||
"{:?} is not a partial proc or another alias: that's a bug!",
|
|
||||||
real_symbol,
|
|
||||||
);
|
|
||||||
|
|
||||||
self.references.push((alias, real_symbol));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn drain(self) -> impl Iterator<Item = (Symbol, PartialProc<'a>)> {
|
pub fn drain(self) -> impl Iterator<Item = (Symbol, PartialProc<'a>)> {
|
||||||
debug_assert_eq!(self.symbols.len(), self.partial_procs.len());
|
debug_assert_eq!(self.symbols.len(), self.partial_procs.len());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue