mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix (x mut &X)
This commit is contained in:
parent
c6cf8ace22
commit
91ffeeb73b
@ -188,7 +188,7 @@ fn (p mut Parser) fn_args() ([]table.Arg,bool) {
|
|||||||
// `int, int, string` (no names, just types)
|
// `int, int, string` (no names, just types)
|
||||||
types_only := p.tok.kind in [.amp, .and] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) || p.peek_tok.kind == .rpar
|
types_only := p.tok.kind in [.amp, .and] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) || p.peek_tok.kind == .rpar
|
||||||
if types_only {
|
if types_only {
|
||||||
// p.warn('types only')
|
//p.warn('types only')
|
||||||
mut arg_no := 1
|
mut arg_no := 1
|
||||||
for p.tok.kind != .rpar {
|
for p.tok.kind != .rpar {
|
||||||
arg_name := 'arg_$arg_no'
|
arg_name := 'arg_$arg_no'
|
||||||
|
@ -93,8 +93,12 @@ pub fn (p mut Parser) parse_type() table.Type {
|
|||||||
p.next()
|
p.next()
|
||||||
is_optional = true
|
is_optional = true
|
||||||
}
|
}
|
||||||
// &Type
|
|
||||||
mut nr_muls := 0
|
mut nr_muls := 0
|
||||||
|
if p.tok.kind == .key_mut {
|
||||||
|
nr_muls++
|
||||||
|
p.next()
|
||||||
|
}
|
||||||
|
// &Type
|
||||||
for p.tok.kind in [.and, .amp] {
|
for p.tok.kind in [.and, .amp] {
|
||||||
if p.tok.kind == .and {
|
if p.tok.kind == .and {
|
||||||
nr_muls += 2
|
nr_muls += 2
|
||||||
@ -104,10 +108,6 @@ pub fn (p mut Parser) parse_type() table.Type {
|
|||||||
}
|
}
|
||||||
p.next()
|
p.next()
|
||||||
}
|
}
|
||||||
if p.tok.kind == .key_mut {
|
|
||||||
nr_muls++
|
|
||||||
p.next()
|
|
||||||
}
|
|
||||||
is_c := p.tok.lit == 'C'
|
is_c := p.tok.lit == 'C'
|
||||||
if is_c {
|
if is_c {
|
||||||
p.next()
|
p.next()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user