remove pub syntax for container fields

This commit is contained in:
Vexu
2019-10-21 22:22:08 +03:00
committed by Andrew Kelley
parent 859cbef8a4
commit 2550cb4638
12 changed files with 54 additions and 66 deletions

View File

@@ -138,9 +138,15 @@ fn parseContainerMembers(arena: *Allocator, it: *TokenIterator, tree: *Tree) !No
continue;
}
if (visib_token != null) {
try tree.errors.push(AstError{
.ExpectedPubItem = AstError.ExpectedPubItem{ .token = it.index },
});
return error.ParseError;
}
if (try parseContainerField(arena, it, tree)) |node| {
const field = node.cast(Node.ContainerField).?;
field.visib_token = visib_token;
field.doc_comments = doc_comments;
try list.push(node);
const comma = eatToken(it, .Comma) orelse break;
@@ -149,13 +155,6 @@ fn parseContainerMembers(arena: *Allocator, it: *TokenIterator, tree: *Tree) !No
continue;
}
// Dangling pub
if (visib_token != null) {
try tree.errors.push(AstError{
.ExpectedPubItem = AstError.ExpectedPubItem{ .token = it.index },
});
}
break;
}
@@ -407,7 +406,6 @@ fn parseContainerField(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No
node.* = Node.ContainerField{
.base = Node{ .id = .ContainerField },
.doc_comments = null,
.visib_token = null,
.name_token = name_token,
.type_expr = type_expr,
.value_expr = value_expr,