Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace foo{
- struct Foo{ field x:Bar; }
- // is equivalent to
- invoke (c) => {
- let Foo = c->create_struct("Foo");
- Foo->set_definition((c) => {
- let x = c->add_field("x");
- x->set_type((c) => c->resolve_type("Bar"));
- });
- }
- function bar(x:i32):Foo{ return c(); }
- // is equivalent to
- invoke (c) => {
- let bar = c->create_function("bar");
- bar->set_signature((c) => {
- c->add_parameter("x", c->get_i32_type());
- c->set_return_type(c->resolve_type("Foo"));
- });
- bar->set_definition((c) => {
- c->create_return_statement(c->create_call(c->resolve_expr("c"), {}));
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement