compiler: save mutability of unnamed fn args

pull/3994/head
Joe Conigliaro 2020-03-12 01:44:41 +11:00
parent 7309be55a0
commit 1cea85df0c
1 changed files with 6 additions and 1 deletions

View File

@ -907,6 +907,11 @@ fn (p mut Parser) fn_args(f mut Fn) {
p.table.known_type(p.lit)) || p.peek() == .rpar // (int, string) p.table.known_type(p.lit)) || p.peek() == .rpar // (int, string)
if types_only { if types_only {
for p.tok != .rpar { for p.tok != .rpar {
is_mut := p.tok == .key_mut
if is_mut {
p.check(.key_mut)
p.fspace()
}
typ := p.get_type() typ := p.get_type()
if typ == '' { if typ == '' {
// && !f.is_c { // && !f.is_c {
@ -918,7 +923,7 @@ p.table.known_type(p.lit)) || p.peek() == .rpar // (int, string)
v := Var{ v := Var{
typ: typ typ: typ
is_arg: true is_arg: true
// is_mut: is_mut is_mut: is_mut
line_nr: p.scanner.line_nr line_nr: p.scanner.line_nr
token_idx: p.cur_tok_index() token_idx: p.cur_tok_index()