|
@@ -2710,9 +2710,11 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
|
|
Keywords.kw_readonly, Keywords.kw_abstract, Keywords.kw_get,
|
|
Keywords.kw_readonly, Keywords.kw_abstract, Keywords.kw_get,
|
|
Keywords.kw_set, Keywords.kw_async, Keywords.kw_await))
|
|
Keywords.kw_set, Keywords.kw_async, Keywords.kw_await))
|
|
return false; // Otherwise automatic semicolon insertion would trigger.
|
|
return false; // Otherwise automatic semicolon insertion would trigger.
|
|
- if (Left.Tok.getIdentifierInfo() &&
|
|
|
|
- Right.startsSequence(tok::l_square, tok::r_square))
|
|
|
|
- return false; // breaking in "foo[]" creates illegal TS type syntax.
|
|
|
|
|
|
+ if (Right.NestingLevel == 0 &&
|
|
|
|
+ (Left.Tok.getIdentifierInfo() ||
|
|
|
|
+ Left.isOneOf(tok::r_square, tok::r_paren)) &&
|
|
|
|
+ Right.isOneOf(tok::l_square, tok::l_paren))
|
|
|
|
+ return false; // Otherwise automatic semicolon insertion would trigger.
|
|
if (Left.is(TT_JsFatArrow) && Right.is(tok::l_brace))
|
|
if (Left.is(TT_JsFatArrow) && Right.is(tok::l_brace))
|
|
return false;
|
|
return false;
|
|
if (Left.is(TT_JsTypeColon))
|
|
if (Left.is(TT_JsTypeColon))
|