Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace foo{
- import macros;
- invoke generate_version(1, 2, 4);
- }
- namespace macros{
- function generate_version(major minor path:i32):TopLevel{
- return (compiler) => {
- let version = compiler.create_global_var("version");
- version->set_type((c) => c.resolve_type("string"));
- version->set_definition((c) =>
- c->create_string_lit(to_string(major) + "." + to_string(minor) + "." + to_string(patch))
- );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement