diff options
| author | Timon Kruiper <timonkruiper@gmail.com> | 2021-04-08 14:22:56 +0200 |
|---|---|---|
| committer | Timon Kruiper <timonkruiper@gmail.com> | 2021-04-08 14:22:56 +0200 |
| commit | 91e416bbf049b875d090ba050081d9964ed4b452 (patch) | |
| tree | cfb780ee22b3b5da33c574489dca348bb632ae5f /src/AstGen.zig | |
| parent | 272fe0cbfe4d59a307389e20b3bf57099b182ebe (diff) | |
| download | zig-91e416bbf049b875d090ba050081d9964ed4b452.tar.gz zig-91e416bbf049b875d090ba050081d9964ed4b452.zip | |
stage2: add a simplified export builtin call
std.builtin.ExportOptions is not yet supported, thus the second argument
of export is now a simple string that specifies the exported symbol
name.
Diffstat (limited to 'src/AstGen.zig')
| -rw-r--r-- | src/AstGen.zig | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index 8ee27b1658..364f76cc7a 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1336,6 +1336,7 @@ fn blockExprStmts( .dbg_stmt_node, .ensure_result_used, .ensure_result_non_error, + .@"export", .set_eval_branch_quota, .compile_log, .ensure_err_payload_void, @@ -4146,6 +4147,18 @@ fn builtinCall( return rvalue(gz, scope, rl, result, node); }, + .@"export" => { + const target_fn = try expr(gz, scope, .none, params[0]); + // FIXME: When structs work in stage2, actually implement this correctly! + // Currently the name is always signifies Strong linkage. + const export_name = try comptimeExpr(gz, scope, .{ .ty = .const_slice_u8_type }, params[1]); + _ = try gz.addPlNode(.@"export", node, zir.Inst.Bin{ + .lhs = target_fn, + .rhs = export_name, + }); + return rvalue(gz, scope, rl, .void_value, node); + }, + .add_with_overflow, .align_cast, .align_of, @@ -4175,7 +4188,6 @@ fn builtinCall( .error_name, .error_return_trace, .err_set_cast, - .@"export", .fence, .field_parent_ptr, .float_to_int, |
