syntax now requires : before type in declarations

This commit is contained in:
uan
2026-02-08 08:40:49 +01:00
parent 7b5eef3bcb
commit 294fbbd69c
3 changed files with 37 additions and 31 deletions

View File

@@ -474,6 +474,8 @@ fn (mut p Parser) parse_class_member() ClassMember {
member_name := p.peek().text
p.expect(.identifier)
p.expect(.colon)
type_tok := p.next()
type_name := match type_tok.type {
.type {type_tok.text}
@@ -741,6 +743,7 @@ fn (mut p Parser) parse_var_decl(is_const bool) VarDecl {
if name_tok.type != .identifier {
parse_error("Expected variable name after let")
}
p.expect(.colon)
type_tok := p.next()
type_name := match type_tok.type {
@@ -816,6 +819,8 @@ fn (mut p Parser) parse_func_decl() FuncDecl {
}
p_name := p.next().text
p.expect(.colon)
type_tok := p.next()
p_type := match type_tok.type {
.type {type_tok.text}