Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix rest of parser
Browse files Browse the repository at this point in the history
Akuli committed Jan 5, 2025
1 parent d2c0f6d commit 02bcaa0
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 8 additions & 2 deletions self_hosted/parser.jou
Original file line number Diff line number Diff line change
@@ -343,12 +343,18 @@ class Parser:
if not is_method:
fail(self->tokens->location, "'self' cannot be used here")

result.args = realloc(result.args, sizeof result.args[0] * (result.nargs+1))
result.args[result.nargs++] = AstNameTypeValue{
self_arg = AstNameTypeValue{
name = "self",
name_location = self->tokens->location,
}
self->tokens++

if self->tokens->is_operator(":"):
self->tokens++
self_arg.type = self->parse_type()

result.args = realloc(result.args, sizeof result.args[0] * (result.nargs+1))
result.args[result.nargs++] = self_arg
used_self = True

else:
2 changes: 0 additions & 2 deletions self_hosted/parses_wrong.txt

This file was deleted.

0 comments on commit 02bcaa0

Please sign in to comment.