Fix old style if
This commit is contained in:
parent
f582ab4eaa
commit
7882e92ab5
@ -1,6 +1,6 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use ast::{AST, Statement, Expression, Declaration, Discriminator};
|
use ast::{AST, Statement, Expression, Declaration, Discriminator, IfExpressionBody};
|
||||||
use symbol_table::{Symbol, SymbolSpec, SymbolTable};
|
use symbol_table::{Symbol, SymbolSpec, SymbolTable};
|
||||||
use builtin::{BinOp, PrefixOp};
|
use builtin::{BinOp, PrefixOp};
|
||||||
|
|
||||||
@ -117,19 +117,18 @@ impl Expression {
|
|||||||
Discriminator::Simple(ref expr) => expr.reduce(symbol_table),
|
Discriminator::Simple(ref expr) => expr.reduce(symbol_table),
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
});
|
});
|
||||||
|
match **body {
|
||||||
Expr::Conditional { cond, then_clause: vec![], else_clause: vec![] }
|
IfExpressionBody::SimpleConditional(ref then_clause, ref else_clause) => {
|
||||||
},
|
let then_clause = then_clause.iter().map(|expr| expr.reduce(symbol_table)).collect();
|
||||||
/*
|
let else_clause = match else_clause {
|
||||||
IfExpression(cond, then_clause, else_clause) => Expr::Conditional {
|
None => vec![],
|
||||||
cond: Box::new((**cond).reduce(symbol_table)),
|
Some(stmts) => stmts.iter().map(|expr| expr.reduce(symbol_table)).collect(),
|
||||||
then_clause: then_clause.iter().map(|expr| expr.reduce(symbol_table)).collect(),
|
};
|
||||||
else_clause: match else_clause {
|
Expr::Conditional { cond, then_clause, else_clause }
|
||||||
None => vec![],
|
},
|
||||||
Some(stmts) => stmts.iter().map(|expr| expr.reduce(symbol_table)).collect(),
|
_ => panic!(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
_ => Expr::UnimplementedSigilValue,
|
_ => Expr::UnimplementedSigilValue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user