Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/fmt.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ const Formatter = struct {
const pattern_region = fmt.nodeRegion(@intFromEnum(p));
_ = try fmt.formatPattern(p);
fmt.curr_indent = curr_indent;
if (i < (a.patterns.span.len - 1)) {
if (i < a.patterns.span.len - 1) {
if (multiline) {
_ = try fmt.flushCommentsBefore(pattern_region.end);
try fmt.ensureNewline();
Expand All @@ -1302,8 +1302,7 @@ const Formatter = struct {
}
try fmt.push('|');
const next_region = fmt.nodeRegion(@intFromEnum(patterns[i + 1]));
const flushed = try fmt.flushCommentsBefore(next_region.start);
if (flushed) {
if (multiline and try fmt.flushCommentsBefore(next_region.start)) {
fmt.curr_indent += 1;
try fmt.pushIndent();
} else {
Expand Down
3 changes: 0 additions & 3 deletions src/parse/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1204,9 +1204,6 @@ fn parseStmtByType(self: *Parser, statementType: StatementType) std.mem.Allocato
.region = .{ .start = start, .end = self.pos },
} });
return statement_idx;
} else if (statementType == .top_level and isCurly) {
// Blocks not allowed as top level statements
return try self.pushMalformed(AST.Statement.Idx, .statement_unexpected_token, start);
}
},
else => {},
Expand Down
Loading
Loading