diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-01-02 22:01:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-02 22:01:51 -0800 |
| commit | d8f3f14532c4b5d65377efaef015c3855137dccf (patch) | |
| tree | d0927df77323d64bff52501b50ef8543a077d4d8 /src/value.zig | |
| parent | 3d151fbfc8db71f87ee84dd33c49910584708a04 (diff) | |
| parent | 654832253a7857e78aab85e28ed09fb16b632dd2 (diff) | |
| download | zig-d8f3f14532c4b5d65377efaef015c3855137dccf.tar.gz zig-d8f3f14532c4b5d65377efaef015c3855137dccf.zip | |
Merge pull request #7647 from ziglang/stage2-comptime-fn-call
stage2: comptime function calls and inline function calls
Diffstat (limited to 'src/value.zig')
| -rw-r--r-- | src/value.zig | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/value.zig b/src/value.zig index 10f58fa44f..11c385b446 100644 --- a/src/value.zig +++ b/src/value.zig @@ -330,11 +330,14 @@ pub const Value = extern union { .int_type => return self.copyPayloadShallow(allocator, Payload.IntType), .int_u64 => return self.copyPayloadShallow(allocator, Payload.U64), .int_i64 => return self.copyPayloadShallow(allocator, Payload.I64), - .int_big_positive => { - @panic("TODO implement copying of big ints"); - }, - .int_big_negative => { - @panic("TODO implement copying of big ints"); + .int_big_positive, .int_big_negative => { + const old_payload = self.cast(Payload.BigInt).?; + const new_payload = try allocator.create(Payload.BigInt); + new_payload.* = .{ + .base = .{ .tag = self.ptr_otherwise.tag }, + .data = try allocator.dupe(std.math.big.Limb, old_payload.data), + }; + return Value{ .ptr_otherwise = &new_payload.base }; }, .function => return self.copyPayloadShallow(allocator, Payload.Function), .extern_fn => return self.copyPayloadShallow(allocator, Payload.Decl), |
