diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 2aaf437df3..581bed9778 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -230,23 +230,9 @@ pub fn (p mut Parser) expr(rbp int) (ast.Expr,types.Type) { if prev_tok.is_right_assoc() { mut expr := ast.Expr{} expr,t2 = p.expr(prev_tok.precedence() - 1) - /* - if prev_tok.is_assign() { - return ast.AssignStmt { - left: node - op: prev_tok.kind - right: expr - }, types.void_type - } - */ - node = ast.BinaryExpr{ left: node - // left_type: t1 - op: prev_tok.kind - // right: p.expr(prev_tok.precedence() - 1) - right: expr } if !types.check(&typ, &t2) { @@ -266,34 +252,6 @@ pub fn (p mut Parser) expr(rbp int) (ast.Expr,types.Type) { return node,typ } -/* -fn (p mut Parser) stmt() ast.Stmt { - if p.tok == .name { - name := p.lit - p.next() - if p.tok == .decl_assign { - p.next() - return ast.VarDecl{ - name: name - expr: p.expr(token.lowest_prec) - } - } - } - /* - match node { - Ident { - - - } - - } - */ - - return ast.VarDecl{} -} -*/ - - fn (p mut Parser) parse_string_literal() (ast.Expr,types.Type) { mut node := ast.Expr{} node = ast.StringLiteral{ diff --git a/vlib/v/parser/parser_test.v b/vlib/v/parser/parser_test.v index 5efee39b12..3c2b9273cd 100644 --- a/vlib/v/parser/parser_test.v +++ b/vlib/v/parser/parser_test.v @@ -39,8 +39,8 @@ fn test_parse_expr() { 'a := 12', 'ab := 10 + 3 * 9', 's := "hi"', - '1 += 2', - // 'a += 10', + // '1 += 2', + 'a += 10', '1.2 + 3.4', '4 + 4', '1 + 2 * 5', @@ -65,8 +65,8 @@ fn test_parse_expr() { 'int a = 12;', 'int ab = 10 + 3 * 9;', 'string s = tos3("hi");', - '1 += 2;', - // 'a += 10;', + // '1 += 2;', + 'a += 10;', '1.2 + 3.4;', '4 + 4;', '1 + 2 * 5;',