mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-26 03:33:44 +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.
|
||||
// TODO: Fix when tuple expressions are supported.
|
||||
(Expression::Tuple(TupleExpression {
|
||||
elements,
|
||||
span: input.span,
|
||||
}), statements)
|
||||
(
|
||||
Expression::Tuple(TupleExpression {
|
||||
elements,
|
||||
span: input.span,
|
||||
}),
|
||||
statements,
|
||||
)
|
||||
}
|
||||
|
||||
/// Consumes a unary expression, accumulating any statements that are generated.
|
||||
|
@ -17,7 +17,10 @@
|
||||
use crate::StaticSingleAssigner;
|
||||
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<'_> {
|
||||
type Output = Function;
|
||||
@ -64,7 +67,7 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||
// Create an assignment statement for the element expression in the tuple.
|
||||
let place = Expression::Identifier(Identifier {
|
||||
name: self.unique_symbol("$ret"),
|
||||
span: Default::default()
|
||||
span: Default::default(),
|
||||
});
|
||||
let value = Expression::Ternary(TernaryExpression {
|
||||
condition: Box::new(guard.clone()),
|
||||
@ -74,7 +77,6 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||
});
|
||||
stmts.push(Self::simple_assign_statement(place.clone(), value));
|
||||
place
|
||||
|
||||
})
|
||||
.collect(),
|
||||
span: Default::default(),
|
||||
@ -85,17 +87,17 @@ impl FunctionConsumer for StaticSingleAssigner<'_> {
|
||||
(expr, acc) => {
|
||||
let place = Expression::Identifier(Identifier {
|
||||
name: self.unique_symbol("$ret"),
|
||||
span: Default::default()
|
||||
span: Default::default(),
|
||||
});
|
||||
let value = Expression::Ternary(TernaryExpression {
|
||||
condition: Box::new(guard.clone()),
|
||||
condition: Box::new(guard),
|
||||
if_true: Box::new(expr),
|
||||
if_false: Box::new(acc),
|
||||
span: Default::default(),
|
||||
});
|
||||
stmts.push(Self::simple_assign_statement(place.clone(), value));
|
||||
place
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -16,7 +16,11 @@
|
||||
|
||||
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 indexmap::IndexSet;
|
||||
|
Loading…
Reference in New Issue
Block a user