mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 12:51:10 +00:00
Update transpile.rs
This commit is contained in:
parent
8149305ca5
commit
b95f043cb1
1 changed files with 6 additions and 2 deletions
|
@ -133,14 +133,18 @@ impl ScriptGenerator {
|
||||||
Expr::Lit(lit) => lit.token.content.to_string(),
|
Expr::Lit(lit) => lit.token.content.to_string(),
|
||||||
Expr::Call(call) => self.transpile_call(call),
|
Expr::Call(call) => self.transpile_call(call),
|
||||||
Expr::BinOp(bin) => {
|
Expr::BinOp(bin) => {
|
||||||
let mut code = self.transpile_expr(*bin.lhs);
|
let mut code = "(".to_string();
|
||||||
|
code += &self.transpile_expr(*bin.lhs);
|
||||||
code += &bin.op.content;
|
code += &bin.op.content;
|
||||||
code += &self.transpile_expr(*bin.rhs);
|
code += &self.transpile_expr(*bin.rhs);
|
||||||
|
code += ")";
|
||||||
code
|
code
|
||||||
}
|
}
|
||||||
Expr::UnaryOp(unary) => {
|
Expr::UnaryOp(unary) => {
|
||||||
let mut code = unary.op.content.to_string();
|
let mut code = "(".to_string();
|
||||||
|
code += &unary.op.content;
|
||||||
code += &self.transpile_expr(*unary.expr);
|
code += &self.transpile_expr(*unary.expr);
|
||||||
|
code += ")";
|
||||||
code
|
code
|
||||||
}
|
}
|
||||||
Expr::Array(array) => match array {
|
Expr::Array(array) => match array {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue