mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 21:44:34 +00:00
eliminate lpop
and use into_iter
This commit is contained in:
parent
c59cace06b
commit
43a3fa6e30
2 changed files with 4 additions and 4 deletions
|
@ -28,10 +28,10 @@ impl Reorderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reorder(mut self, mut ast: AST) -> Result<AST, TyCheckErrors> {
|
pub fn reorder(mut self, ast: AST) -> Result<AST, TyCheckErrors> {
|
||||||
log!(info "the reordering process has started.");
|
log!(info "the reordering process has started.");
|
||||||
let mut new = vec![];
|
let mut new = vec![];
|
||||||
while let Some(chunk) = ast.module.lpop() {
|
for chunk in ast.module.into_iter() {
|
||||||
match chunk {
|
match chunk {
|
||||||
Expr::Def(def) => {
|
Expr::Def(def) => {
|
||||||
match def.body.block.first().unwrap() {
|
match def.body.block.first().unwrap() {
|
||||||
|
|
|
@ -305,9 +305,9 @@ impl Desugarer {
|
||||||
|
|
||||||
/// `fib 0 = 0; fib 1 = 1; fib n = fib(n-1) + fib(n-2)`
|
/// `fib 0 = 0; fib 1 = 1; fib n = fib(n-1) + fib(n-2)`
|
||||||
/// -> `fib n = match n, (0 -> 0), (1 -> 1), n -> fib(n-1) + fib(n-2)`
|
/// -> `fib n = match n, (0 -> 0), (1 -> 1), n -> fib(n-1) + fib(n-2)`
|
||||||
fn desugar_multiple_pattern_def(&self, mut module: Module) -> Module {
|
fn desugar_multiple_pattern_def(&self, module: Module) -> Module {
|
||||||
let mut new = Module::with_capacity(module.len());
|
let mut new = Module::with_capacity(module.len());
|
||||||
while let Some(chunk) = module.lpop() {
|
for chunk in module.into_iter() {
|
||||||
match chunk {
|
match chunk {
|
||||||
Expr::Def(def) if def.is_subr() => {
|
Expr::Def(def) if def.is_subr() => {
|
||||||
if let Some(Expr::Def(previous)) = new.last() {
|
if let Some(Expr::Def(previous)) = new.last() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue