mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-26 11:45:00 +03:00
Fmt & clippy
This commit is contained in:
parent
5b732a33be
commit
a2795baed8
@ -246,10 +246,13 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> {
|
|||||||
|
|
||||||
// Note that we do not construct new assignment statement for the tuple expression, since tuple expressions are not supported.
|
// Note that we do not construct new assignment statement for the tuple expression, since tuple expressions are not supported.
|
||||||
// TODO: Fix when tuple expressions are supported.
|
// TODO: Fix when tuple expressions are supported.
|
||||||
(Expression::Tuple(TupleExpression {
|
(
|
||||||
elements,
|
Expression::Tuple(TupleExpression {
|
||||||
span: input.span,
|
elements,
|
||||||
}), statements)
|
span: input.span,
|
||||||
|
}),
|
||||||
|
statements,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Consumes a unary expression, accumulating any statements that are generated.
|
/// Consumes a unary expression, accumulating any statements that are generated.
|
||||||
|
@ -17,7 +17,10 @@
|
|||||||
use crate::StaticSingleAssigner;
|
use crate::StaticSingleAssigner;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use leo_ast::{Block, Expression, ExpressionConsumer, Function, FunctionConsumer, Identifier, Program, ProgramConsumer, ReturnStatement, Statement, StatementConsumer, TernaryExpression, TupleExpression};
|
use leo_ast::{
|
||||||
|
Block, Expression, Function, FunctionConsumer, Identifier, Program, ProgramConsumer, ReturnStatement, Statement,
|
||||||
|
StatementConsumer, TernaryExpression, TupleExpression,
|
||||||
|
};
|
||||||
|
|
||||||
impl FunctionConsumer for StaticSingleAssigner<'_> {
|
impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||||
type Output = Function;
|
type Output = Function;
|
||||||
@ -64,7 +67,7 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
|||||||
// Create an assignment statement for the element expression in the tuple.
|
// Create an assignment statement for the element expression in the tuple.
|
||||||
let place = Expression::Identifier(Identifier {
|
let place = Expression::Identifier(Identifier {
|
||||||
name: self.unique_symbol("$ret"),
|
name: self.unique_symbol("$ret"),
|
||||||
span: Default::default()
|
span: Default::default(),
|
||||||
});
|
});
|
||||||
let value = Expression::Ternary(TernaryExpression {
|
let value = Expression::Ternary(TernaryExpression {
|
||||||
condition: Box::new(guard.clone()),
|
condition: Box::new(guard.clone()),
|
||||||
@ -74,7 +77,6 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
|||||||
});
|
});
|
||||||
stmts.push(Self::simple_assign_statement(place.clone(), value));
|
stmts.push(Self::simple_assign_statement(place.clone(), value));
|
||||||
place
|
place
|
||||||
|
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
span: Default::default(),
|
span: Default::default(),
|
||||||
@ -85,17 +87,17 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
|||||||
(expr, acc) => {
|
(expr, acc) => {
|
||||||
let place = Expression::Identifier(Identifier {
|
let place = Expression::Identifier(Identifier {
|
||||||
name: self.unique_symbol("$ret"),
|
name: self.unique_symbol("$ret"),
|
||||||
span: Default::default()
|
span: Default::default(),
|
||||||
});
|
});
|
||||||
let value = Expression::Ternary(TernaryExpression {
|
let value = Expression::Ternary(TernaryExpression {
|
||||||
condition: Box::new(guard.clone()),
|
condition: Box::new(guard),
|
||||||
if_true: Box::new(expr),
|
if_true: Box::new(expr),
|
||||||
if_false: Box::new(acc),
|
if_false: Box::new(acc),
|
||||||
span: Default::default(),
|
span: Default::default(),
|
||||||
});
|
});
|
||||||
stmts.push(Self::simple_assign_statement(place.clone(), value));
|
stmts.push(Self::simple_assign_statement(place.clone(), value));
|
||||||
place
|
place
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,7 +16,11 @@
|
|||||||
|
|
||||||
use crate::{RenameTable, StaticSingleAssigner};
|
use crate::{RenameTable, StaticSingleAssigner};
|
||||||
|
|
||||||
use leo_ast::{AssignStatement, BinaryExpression, BinaryOperation, Block, ConditionalStatement, ConsoleStatement, DefinitionStatement, Expression, ExpressionConsumer, Identifier, IterationStatement, Node, ReturnStatement, Statement, StatementConsumer, TernaryExpression, TupleExpression, UnaryExpression, UnaryOperation};
|
use leo_ast::{
|
||||||
|
AssignStatement, BinaryExpression, BinaryOperation, Block, ConditionalStatement, ConsoleStatement,
|
||||||
|
DefinitionStatement, Expression, ExpressionConsumer, Identifier, IterationStatement, Node, ReturnStatement,
|
||||||
|
Statement, StatementConsumer, TernaryExpression, UnaryExpression, UnaryOperation,
|
||||||
|
};
|
||||||
use leo_span::Symbol;
|
use leo_span::Symbol;
|
||||||
|
|
||||||
use indexmap::IndexSet;
|
use indexmap::IndexSet;
|
||||||
|
Loading…
Reference in New Issue
Block a user