fix function parameter parsing
- fix struct's err ctx - rm err when parsing get exprs and others
This commit is contained in:
parent
075d2f22a5
commit
126bd476d6
1 changed files with 6 additions and 2 deletions
|
@ -463,12 +463,15 @@ pub const Parser = struct {
|
|||
|
||||
while (self.peek().typ != .RightParen) {
|
||||
const param_name = try self.consumeSingle(.Identifier);
|
||||
_ = try self.consumeSingle(.Colon);
|
||||
const param_type = try self.consumeSingle(.Identifier);
|
||||
|
||||
try param_list.append(ast.ParamDecl{
|
||||
.name = param_name,
|
||||
.typ = param_type,
|
||||
});
|
||||
|
||||
if (self.check(.Comma)) _ = try self.consumeSingle(.Comma);
|
||||
}
|
||||
|
||||
_ = try self.consumeSingle(.RightParen);
|
||||
|
@ -547,7 +550,7 @@ pub const Parser = struct {
|
|||
fn parseStructDecl(self: *@This()) !*Node {
|
||||
var fields = ast.FieldList.init(self.allocator);
|
||||
errdefer fields.deinit();
|
||||
self.setErrContext("struct", name);
|
||||
self.setErrContext("struct");
|
||||
|
||||
_ = try self.consumeSingle(.Struct);
|
||||
var name = try self.consumeSingle(.Identifier);
|
||||
|
@ -1046,7 +1049,8 @@ pub const Parser = struct {
|
|||
expr = try self.mkGet(expr, name);
|
||||
}
|
||||
} else {
|
||||
return self.tokenError(self.peek(), "Expect expression.");
|
||||
//return self.tokenError(self.peek(), "Expect expression.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue