Skip to content

Commit

Permalink
Apply suggestions from @Erigara
Browse files Browse the repository at this point in the history
Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
  • Loading branch information
Arjentix committed Aug 16, 2022
1 parent e49e9e9 commit cf8f9c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
1 change: 0 additions & 1 deletion core/src/queue.rs
Expand Up @@ -367,7 +367,6 @@ mod tests {
));
}

// #[ignore = "Multisignature is not working for now. See #2595"]
#[test]
fn push_multisignature_tx() {
let key_pairs = [KeyPair::generate().unwrap(), KeyPair::generate().unwrap()];
Expand Down
33 changes: 12 additions & 21 deletions data_model/src/expression.rs
Expand Up @@ -100,30 +100,18 @@ use super::{query::QueryBox, Value, ValueBox};
/// }
/// ```
macro_rules! gen_expr_and_impls {
// Case: one unnamed parameter with known result type
($(#[$me:meta])* $v:vis $i:ident($first_type:ty $(,)?) -> $result_type:ty) => {
gen_expr_and_impls!($(#[$me])* $v $i(expression: $first_type) -> $result_type);
// Case: one unnamed parameter
($(#[$me:meta])* $v:vis $i:ident($first_type:ty $(,)?) -> $($result:tt)*) => {
gen_expr_and_impls!($(#[$me])* $v $i(expression: $first_type) -> $($result)*);
};
// Case: one unnamed parameter with unknown result type
($(#[$me:meta])* $v:vis $i:ident($first_type:ty $(,)?) -> ?) => {
gen_expr_and_impls!($(#[$me])* $v $i(expression: $first_type) -> ?);
// Case: two unnamed parameters
($(#[$me:meta])* $v:vis $i:ident($first_type:ty, $second_type:ty $(,)?) -> $($result:tt)*) => {
gen_expr_and_impls!($(#[$me])* $v $i(left: $first_type, right: $second_type) -> $($result)*);
};
// Case: two unnamed parameters with known result type
($(#[$me:meta])* $v:vis $i:ident($first_type:ty, $second_type:ty $(,)?) -> $result_type:ty) => {
gen_expr_and_impls!($(#[$me])* $v $i(left: $first_type, right: $second_type) -> $result_type);
};
// Case: two unnamed parameters with unknown result type
($(#[$me:meta])* $v:vis $i:ident($first_type:ty, $second_type:ty $(,)?) -> ?) => {
gen_expr_and_impls!($(#[$me])* $v $i(left: $first_type, right: $second_type) -> ?);
};
// Case: any number of named parameters with unknown result type
($(#[$me:meta])* $v:vis $i:ident($($param_name:ident: $param_type:ty),* $(,)?) -> ?) => {
// Case: any number of named parameters
($(#[$me:meta])* $v:vis $i:ident($($param_name:ident: $param_type:ty),* $(,)?) -> $($result:tt)*) => {
gen_expr_and_impls!(impl_basic $(#[$me])* $v $i($($param_name: $param_type),*));
};
// Case: any number of named parameters with known result type
($(#[$me:meta])* $v:vis $i:ident($($param_name:ident: $param_type:ty),* $(,)?) -> $result_type:ty) => {
gen_expr_and_impls!(impl_basic $(#[$me])* $v $i($($param_name: $param_type),*));
gen_expr_and_impls!(impl_extra_convert $i $result_type);
gen_expr_and_impls!(impl_extra_convert $i $($result)*);
};
// Internal usage: generate basic code for the expression
(impl_basic $(#[$me:meta])* $v:vis $i:ident($($param_name:ident: $param_type:ty),* $(,)?)) => {
Expand Down Expand Up @@ -158,6 +146,9 @@ macro_rules! gen_expr_and_impls {
}
}
};
// Internal usage: do nothing for expressions with unknown result type
(impl_extra_convert $i:ident ?) => {
};
// Internal usage: generate extra `From` impl for expressions with known result type
(impl_extra_convert $i:ident $result_type:ty) => {
impl From<$i> for EvaluatesTo<$result_type> {
Expand Down

0 comments on commit cf8f9c8

Please sign in to comment.