syntax now requires : before type in declarations
This commit is contained in:
5
parser.v
5
parser.v
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user