| ... | ... | @@ -724,16 +724,12 @@ fn parseIfStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node |
| 724 | 724 | const if_prefix = if_node.cast(Node.If).?; |
| 725 | 725 | |
| 726 | 726 | const block_expr = (try parseBlockExpr(arena, it, tree)); |
| 727 | | const assign_expr = if (block_expr == null) blk: { |
| 728 | | break :blk (try parseAssignExpr(arena, it, tree)) orelse null; |
| 729 | | } else null; |
| 730 | | |
| 731 | | if (block_expr == null and assign_expr == null) { |
| 732 | | try tree.errors.push(.{ |
| 727 | const assign_expr = if (block_expr == null) |
| 728 | try expectNode(arena, it, tree, parseAdditionExpr, .{ |
| 733 | 729 | .ExpectedBlockOrAssignment = .{ .token = it.index }, |
| 734 | | }); |
| 735 | | return error.ParseError; |
| 736 | | } |
| 730 | }) |
| 731 | else |
| 732 | null; |
| 737 | 733 | |
| 738 | 734 | const semicolon = if (assign_expr != null) eatToken(it, .Semicolon) else null; |
| 739 | 735 | |
| ... | ... | @@ -770,10 +766,9 @@ fn parseIfStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node |
| 770 | 766 | try tree.errors.push(.{ |
| 771 | 767 | .ExpectedSemiOrElse = .{ .token = it.index }, |
| 772 | 768 | }); |
| 773 | | return error.ParseError; |
| 774 | 769 | } |
| 775 | 770 | |
| 776 | | unreachable; |
| 771 | return if_node; |
| 777 | 772 | } |
| 778 | 773 | |
| 779 | 774 | /// LabeledStatement <- BlockLabel? (Block / LoopStatement) |
| ... | ... | @@ -879,7 +874,8 @@ fn parseForStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node |
| 879 | 874 | try tree.errors.push(.{ |
| 880 | 875 | .ExpectedSemiOrElse = .{ .token = it.index }, |
| 881 | 876 | }); |
| 882 | | return null; |
| 877 | |
| 878 | return node; |
| 883 | 879 | } |
| 884 | 880 | |
| 885 | 881 | return null; |
| ... | ... | @@ -941,7 +937,8 @@ fn parseWhileStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No |
| 941 | 937 | try tree.errors.push(.{ |
| 942 | 938 | .ExpectedSemiOrElse = .{ .token = it.index }, |
| 943 | 939 | }); |
| 944 | | return null; |
| 940 | |
| 941 | return node; |
| 945 | 942 | } |
| 946 | 943 | |
| 947 | 944 | return null; |