1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ast, parser: patches for VLS (#9562)

This commit is contained in:
Ned Palacios
2021-04-02 22:26:37 +08:00
committed by GitHub
parent af14c808a3
commit 1bb48c3577
6 changed files with 24 additions and 11 deletions

View File

@@ -2024,6 +2024,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
}
// `Color.green`
mut enum_name := p.check_name()
enum_name_pos := p.prev_tok.position()
if mod != '' {
enum_name = mod + '.' + enum_name
} else {
@@ -2037,7 +2038,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
return ast.EnumVal{
enum_name: enum_name
val: val
pos: p.tok.position()
pos: enum_name_pos.extend(p.prev_tok.position())
mod: mod
}
} else if language == .js && p.peek_tok.kind == .dot && p.peek_token(2).kind == .name {
@@ -2236,6 +2237,7 @@ fn (mut p Parser) dot_expr(left ast.Expr) ast.Expr {
left: left
name: field_name
args: args
name_pos: name_pos
pos: pos
is_method: true
generic_types: generic_types

View File

@@ -409,6 +409,7 @@ fn (mut p Parser) struct_init(short_syntax bool) ast.StructInit {
name_pos: first_field_pos
comments: comments
next_comments: nline_comments
parent_type: typ
}
}
}