Rename macro to include_bytes!()
This commit is contained in:
		
							parent
							
								
									7234cad5f0
								
							
						
					
					
						commit
						2303bf757a
					
				| @ -2,8 +2,7 @@ import std::String; | |||||||
| import std::print; | import std::print; | ||||||
| 
 | 
 | ||||||
| fn main() -> u8 { | fn main() -> u8 { | ||||||
|     // - TODO possibly allow to cast between &[ty] and *ty |     let bytes = include_bytes!("./macro_easy_file.txt"); | ||||||
|     let bytes = test_macro!("./macro_easy_file.txt"); |  | ||||||
|     print(String::new() + bytes.length()); |     print(String::new() + bytes.length()); | ||||||
|     return (bytes as *u8)[0]; |     return (bytes as *u8)[0]; | ||||||
| } | } | ||||||
|  | |||||||
| @ -212,14 +212,14 @@ impl mir::Expression { | |||||||
| pub fn form_macros() -> HashMap<String, Box<dyn MacroFunction>> { | pub fn form_macros() -> HashMap<String, Box<dyn MacroFunction>> { | ||||||
|     let mut macros: HashMap<String, Box<dyn MacroFunction>> = HashMap::new(); |     let mut macros: HashMap<String, Box<dyn MacroFunction>> = HashMap::new(); | ||||||
| 
 | 
 | ||||||
|     macros.insert("test_macro".to_owned(), Box::new(TestMacro)); |     macros.insert("include_bytes".to_owned(), Box::new(IncludeBytes)); | ||||||
| 
 | 
 | ||||||
|     macros |     macros | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #[derive(Debug)] | #[derive(Debug)] | ||||||
| pub struct TestMacro; | pub struct IncludeBytes; | ||||||
| impl MacroFunction for TestMacro { | impl MacroFunction for IncludeBytes { | ||||||
|     fn generate<'ctx, 'a>( |     fn generate<'ctx, 'a>( | ||||||
|         &self, |         &self, | ||||||
|         module: &MacroModule, |         module: &MacroModule, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user