Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Erk- committed Nov 26, 2024
1 parent 9c7b49d commit b863f2b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
26 changes: 24 additions & 2 deletions rrust-macro/src/reverse.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use proc_macro2::TokenStream;
use quote::ToTokens;
use syn::{fold::Fold, parse::Parser, ExprBinary, StmtMacro};
use syn::{fold::Fold, parse::Parser, ExprBinary, ExprMethodCall, StmtMacro};

use crate::utils::{delocal_ident_stmt, local_ident};

Expand Down Expand Up @@ -278,7 +278,29 @@ fn reverse_expr(e: Expr) -> Expr {
}
}
Expr::Match(_) => panic!("Not yet implemented {}", line!()),
Expr::MethodCall(_) => panic!("Not yet implemented {}", line!()),
Expr::MethodCall(ExprMethodCall {
attrs,
receiver,
dot_token,
method,
turbofish,
paren_token,
args,
}) => {
//std::slice::swap
if method.to_string() == "swap" {
return Expr::MethodCall(ExprMethodCall {
attrs,
receiver,
dot_token,
method,
turbofish,
paren_token,
args,
});
}
panic!("Not yet implemented {}", line!())
}
Expr::Paren(_) => panic!("Not yet implemented {}", line!()),
Expr::Path(_) => panic!("Not yet implemented {}", line!()),
Expr::Range(_) => panic!("Not yet implemented {}", line!()),
Expand Down
2 changes: 1 addition & 1 deletion rrust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ pub use rrust_macro::{forward, reverse};
macro_rules! delocal {
($name:ident, $e:expr) => {
if $name != $e {
panic!("Delocal failed {} != {}", $name, $e);
panic!("Delocal failed {:?} != {:?}", $name, $e);
}
drop($name);
};
Expand Down

0 comments on commit b863f2b

Please sign in to comment.