Advertisement
tinyevil

Untitled

Jul 6th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. namespace foo{
  2. import macros;
  3.  
  4. invoke generate_version(1, 2, 4);
  5. }
  6.  
  7. namespace macros{
  8. function generate_version(major minor path:i32):TopLevel{
  9. return (compiler) => {
  10. let version = compiler.create_global_var("version");
  11. version->set_type((c) => c.resolve_type("string"));
  12. version->set_definition((c) =>
  13. c->create_string_lit(to_string(major) + "." + to_string(minor) + "." + to_string(patch))
  14. );
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement