From bb76e5da911bbfc9ac44c1eea12b5f5ab62660d8 Mon Sep 17 00:00:00 2001 From: Joe Conigliaro Date: Wed, 25 Mar 2020 20:09:50 +1100 Subject: [PATCH] parser: array map fixe --- vlib/v/parser/parser.v | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 06b6f5c814..d25571cc84 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -974,7 +974,8 @@ fn (p mut Parser) filter() { fn (p mut Parser) dot_expr(left ast.Expr) ast.Expr { p.next() field_name := p.check_name() - if field_name == 'filter' { + is_filter := field_name in ['filter', 'map'] + if is_filter { p.open_scope() p.filter() // wrong tok position when using defer @@ -1009,7 +1010,7 @@ fn (p mut Parser) dot_expr(left ast.Expr) ast.Expr { } mut node := ast.Expr{} node = mcall_expr - if field_name == 'filter' { + if is_filter { p.close_scope() } return node @@ -1021,7 +1022,7 @@ fn (p mut Parser) dot_expr(left ast.Expr) ast.Expr { } mut node := ast.Expr{} node = sel_expr - if field_name == 'filter' { + if is_filter { p.close_scope() } return node