From 8139c5a516eaa217ed76acdf09496895451c5c5c Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Tue, 13 Nov 2018 05:08:37 -0800 Subject: New Zig formal grammar (#1685) Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected --- std/atomic/stack.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'std/atomic/stack.zig') diff --git a/std/atomic/stack.zig b/std/atomic/stack.zig index 9222b8de50..b69a93733c 100644 --- a/std/atomic/stack.zig +++ b/std/atomic/stack.zig @@ -5,19 +5,19 @@ const AtomicOrder = builtin.AtomicOrder; /// Many reader, many writer, non-allocating, thread-safe /// Uses a spinlock to protect push() and pop() pub fn Stack(comptime T: type) type { - return struct.{ + return struct { root: ?*Node, lock: u8, pub const Self = @This(); - pub const Node = struct.{ + pub const Node = struct { next: ?*Node, data: T, }; pub fn init() Self { - return Self.{ + return Self{ .root = null, .lock = 0, }; @@ -54,7 +54,7 @@ pub fn Stack(comptime T: type) type { } const std = @import("../index.zig"); -const Context = struct.{ +const Context = struct { allocator: *std.mem.Allocator, stack: *Stack(i32), put_sum: isize, @@ -81,7 +81,7 @@ test "std.atomic.stack" { var a = &fixed_buffer_allocator.allocator; var stack = Stack(i32).init(); - var context = Context.{ + var context = Context{ .allocator = a, .stack = &stack, .put_sum = 0, @@ -125,7 +125,7 @@ fn startPuts(ctx: *Context) u8 { while (put_count != 0) : (put_count -= 1) { std.os.time.sleep(1); // let the os scheduler be our fuzz const x = @bitCast(i32, r.random.scalar(u32)); - const node = ctx.allocator.create(Stack(i32).Node.{ + const node = ctx.allocator.create(Stack(i32).Node{ .next = undefined, .data = x, }) catch unreachable; -- cgit v1.2.3