File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -1497,7 +1497,7 @@ class AstNodeVisitor extends ThrowingAstVisitor<Piece> with PieceFactory {
1497
1497
1498
1498
@override
1499
1499
Piece visitRethrowExpression (RethrowExpression node) {
1500
- throw UnimplementedError ( );
1500
+ return tokenPiece (node.rethrowKeyword );
1501
1501
}
1502
1502
1503
1503
@override
@@ -1712,7 +1712,11 @@ class AstNodeVisitor extends ThrowingAstVisitor<Piece> with PieceFactory {
1712
1712
1713
1713
@override
1714
1714
Piece visitThrowExpression (ThrowExpression node) {
1715
- throw UnimplementedError ();
1715
+ return buildPiece ((b) {
1716
+ b.token (node.throwKeyword);
1717
+ b.space ();
1718
+ b.visit (node.expression);
1719
+ });
1716
1720
}
1717
1721
1718
1722
@override
Original file line number Diff line number Diff line change @@ -55,3 +55,29 @@ foo() async {
55
55
foo() async {
56
56
await i(1 + 2);
57
57
}
58
+ >>> Throw.
59
+ throw 'error'
60
+ ;
61
+ <<<
62
+ throw 'error';
63
+ >>> Throw doesn't split after the 'throw' keyword.
64
+ throw 'Some extremely long error message.';
65
+ <<<
66
+ throw 'Some extremely long error message.';
67
+ >>> Throw with long string literal.
68
+ throw new FormatException('This is a long exception message.');
69
+ <<<
70
+ throw new FormatException(
71
+ 'This is a long exception message.',
72
+ );
73
+ >>> Rethrow.
74
+ try {
75
+ throw 1 ;
76
+ } catch (e) {
77
+ rethrow ;}
78
+ <<<
79
+ try {
80
+ throw 1;
81
+ } catch (e) {
82
+ rethrow;
83
+ }
You can’t perform that action at this time.
0 commit comments