Skip to content

Commit

Permalink
remove abort() transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
damirka committed Jul 2, 2024
1 parent 0526e36 commit 08d5b54
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,6 @@ function printAbortExpression(path: AstPath<Node>, options: ParserOptions, print
const expression = path.node.nonFormattingChildren[0];
const printed = path.call(print, 'nonFormattingChildren', 0);

// Special case in `abort`. Historically, people have been using `abort` with
// parentheses, which are not required. We can format against it. Note, that
// we only do this for `abort` and should never do for other cases where
// `expression_list` is used, because it affects the semantics.
if (expression?.type === 'expression_list') {
return group([
'abort',
indent(line),
indent(
path.call(
(path) => path.call(print, 'nonFormattingChildren', 0),
'nonFormattingChildren',
0,
),
),
]);
}

return group([
'abort',
expression?.isList || expression?.isControlFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
module prettier::abort_expression {
fun abort_expression() {
abort 0;
abort 0;
abort 10;
abort (0);
abort (10);
abort {
10
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module sui::test_utils {
std::debug::print(t1);
print(b"!=");
std::debug::print(t2);
abort 0
abort (0)
}
}

Expand Down

0 comments on commit 08d5b54

Please sign in to comment.