Rename macro to include_bytes!()

This commit is contained in:
Sofia 2025-07-29 15:57:26 +03:00
parent 7234cad5f0
commit 2303bf757a
2 changed files with 4 additions and 5 deletions

View File

@ -2,8 +2,7 @@ import std::String;
import std::print;
fn main() -> u8 {
// - TODO possibly allow to cast between &[ty] and *ty
let bytes = test_macro!("./macro_easy_file.txt");
let bytes = include_bytes!("./macro_easy_file.txt");
print(String::new() + bytes.length());
return (bytes as *u8)[0];
}

View File

@ -212,14 +212,14 @@ impl mir::Expression {
pub fn form_macros() -> HashMap<String, Box<dyn MacroFunction>> {
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
}
#[derive(Debug)]
pub struct TestMacro;
impl MacroFunction for TestMacro {
pub struct IncludeBytes;
impl MacroFunction for IncludeBytes {
fn generate<'ctx, 'a>(
&self,
module: &MacroModule,