Move rc! macro to util

So it can be used anywhere
This commit is contained in:
greg 2019-03-08 01:15:19 -08:00
parent 98db60498a
commit 956353cd80
4 changed files with 8 additions and 5 deletions

View File

@ -30,8 +30,10 @@ macro_rules! bx {
}
#[macro_use]
mod typechecking;
mod util;
#[macro_use]
mod typechecking;
mod tokenizing;
mod ast;
mod parsing;

View File

@ -1138,9 +1138,6 @@ mod parse_tests {
parser.parse()
}
macro_rules! rc {
($string:tt) => { Rc::new(stringify!($string).to_string()) }
}
macro_rules! parse_test {
($string:expr, $correct:expr) => { assert_eq!(parse($string).unwrap(), $correct) };
}

View File

@ -202,7 +202,7 @@ mod symbol_table_tests {
#[test]
fn basic_symbol_table() {
values_in_table! { "let a = 10; fn b() { 20 }", &Rc::new("b".to_string()) };
values_in_table! { "let a = 10; fn b() { 20 }", &rc!(b) };
}
}

View File

@ -47,3 +47,7 @@ pub fn quick_ast(input: &str) -> crate::ast::AST {
let mut parser = crate::parsing::Parser::new(tokens);
parser.parse().unwrap()
}
macro_rules! rc {
($string:tt) => { Rc::new(stringify!($string).to_string()) }
}