Skip to content

Commit dcc83f2

Browse files
committed
One more syntax sync.
1 parent 641d1d7 commit dcc83f2

File tree

3 files changed

+53
-21
lines changed

3 files changed

+53
-21
lines changed

lib/4.06.1/unstable/js_playground_compiler.ml

+26-10
Original file line numberDiff line numberDiff line change
@@ -269919,6 +269919,7 @@ val hasOptionalAttribute : Parsetree.attributes -> bool
269919269919
val shouldIndentBinaryExpr : Parsetree.expression -> bool
269920269920
val shouldInlineRhsBinaryExpr : Parsetree.expression -> bool
269921269921
val hasPrintableAttributes : Parsetree.attributes -> bool
269922+
val filterPrintableAttributes : Parsetree.attributes -> Parsetree.attributes
269922269923
val partitionPrintableAttributes :
269923269924
Parsetree.attributes -> Parsetree.attributes * Parsetree.attributes
269924269925

@@ -270508,6 +270509,8 @@ let isPrintableAttribute attr =
270508270509

270509270510
let hasPrintableAttributes attrs = List.exists isPrintableAttribute attrs
270510270511

270512+
let filterPrintableAttributes attrs = List.filter isPrintableAttribute attrs
270513+
270511270514
let partitionPrintableAttributes attrs =
270512270515
List.partition isPrintableAttribute attrs
270513270516

@@ -275163,7 +275166,7 @@ val subBinaryExprOperand : string -> string -> bool
275163275166
val rhsBinaryExprOperand : string -> Parsetree.expression -> bool
275164275167
val flattenOperandRhs : string -> Parsetree.expression -> bool
275165275168

275166-
val lazyOrAssertExprRhs : Parsetree.expression -> kind
275169+
val lazyOrAssertOrAwaitExprRhs : Parsetree.expression -> kind
275167275170

275168275171
val fieldExpr : Parsetree.expression -> kind
275169275172

@@ -275367,7 +275370,7 @@ let flattenOperandRhs parentOperator rhs =
275367275370
| _ when ParsetreeViewer.isTernaryExpr rhs -> true
275368275371
| _ -> false
275369275372

275370-
let lazyOrAssertExprRhs expr =
275373+
let lazyOrAssertOrAwaitExprRhs expr =
275371275374
let optBraces, _ = ParsetreeViewer.processBracesAttr expr in
275372275375
match optBraces with
275373275376
| Some ({Location.loc = bracesLoc}, _) -> Braced bracesLoc
@@ -278745,7 +278748,7 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
278745278748
| Pexp_assert expr ->
278746278749
let rhs =
278747278750
let doc = printExpressionWithComments ~customLayout expr cmtTbl in
278748-
match Parens.lazyOrAssertExprRhs expr with
278751+
match Parens.lazyOrAssertOrAwaitExprRhs expr with
278749278752
| Parens.Parenthesized -> addParens doc
278750278753
| Braced braces -> printBraces doc expr braces
278751278754
| Nothing -> doc
@@ -278754,7 +278757,7 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
278754278757
| Pexp_lazy expr ->
278755278758
let rhs =
278756278759
let doc = printExpressionWithComments ~customLayout expr cmtTbl in
278757-
match Parens.lazyOrAssertExprRhs expr with
278760+
match Parens.lazyOrAssertOrAwaitExprRhs expr with
278758278761
| Parens.Parenthesized -> addParens doc
278759278762
| Braced braces -> printBraces doc expr braces
278760278763
| Nothing -> doc
@@ -278932,7 +278935,24 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
278932278935
in
278933278936
let exprWithAwait =
278934278937
if ParsetreeViewer.hasAwaitAttribute e.pexp_attributes then
278935-
Doc.concat [Doc.text "await "; printedExpression]
278938+
let rhs =
278939+
match
278940+
Parens.lazyOrAssertOrAwaitExprRhs
278941+
{
278942+
e with
278943+
pexp_attributes =
278944+
List.filter
278945+
(function
278946+
| {Location.txt = "res.await" | "ns.braces"}, _ -> false
278947+
| _ -> true)
278948+
e.pexp_attributes;
278949+
}
278950+
with
278951+
| Parens.Parenthesized -> addParens printedExpression
278952+
| Braced braces -> printBraces printedExpression e braces
278953+
| Nothing -> printedExpression
278954+
in
278955+
Doc.concat [Doc.text "await "; rhs]
278936278956
else printedExpression
278937278957
in
278938278958
let shouldPrintItsOwnAttributes =
@@ -279330,11 +279350,7 @@ and printBinaryExpression ~customLayout (expr : Parsetree.expression) cmtTbl =
279330279350
{
279331279351
expr with
279332279352
pexp_attributes =
279333-
List.filter
279334-
(fun attr ->
279335-
match attr with
279336-
| {Location.txt = "ns.braces"}, _ -> false
279337-
| _ -> true)
279353+
ParsetreeViewer.filterPrintableAttributes
279338279354
expr.pexp_attributes;
279339279355
}
279340279356
with

lib/4.06.1/whole_compiler.ml

+26-10
Original file line numberDiff line numberDiff line change
@@ -275664,6 +275664,7 @@ val hasOptionalAttribute : Parsetree.attributes -> bool
275664275664
val shouldIndentBinaryExpr : Parsetree.expression -> bool
275665275665
val shouldInlineRhsBinaryExpr : Parsetree.expression -> bool
275666275666
val hasPrintableAttributes : Parsetree.attributes -> bool
275667+
val filterPrintableAttributes : Parsetree.attributes -> Parsetree.attributes
275667275668
val partitionPrintableAttributes :
275668275669
Parsetree.attributes -> Parsetree.attributes * Parsetree.attributes
275669275670

@@ -276253,6 +276254,8 @@ let isPrintableAttribute attr =
276253276254

276254276255
let hasPrintableAttributes attrs = List.exists isPrintableAttribute attrs
276255276256

276257+
let filterPrintableAttributes attrs = List.filter isPrintableAttribute attrs
276258+
276256276259
let partitionPrintableAttributes attrs =
276257276260
List.partition isPrintableAttribute attrs
276258276261

@@ -280908,7 +280911,7 @@ val subBinaryExprOperand : string -> string -> bool
280908280911
val rhsBinaryExprOperand : string -> Parsetree.expression -> bool
280909280912
val flattenOperandRhs : string -> Parsetree.expression -> bool
280910280913

280911-
val lazyOrAssertExprRhs : Parsetree.expression -> kind
280914+
val lazyOrAssertOrAwaitExprRhs : Parsetree.expression -> kind
280912280915

280913280916
val fieldExpr : Parsetree.expression -> kind
280914280917

@@ -281112,7 +281115,7 @@ let flattenOperandRhs parentOperator rhs =
281112281115
| _ when ParsetreeViewer.isTernaryExpr rhs -> true
281113281116
| _ -> false
281114281117

281115-
let lazyOrAssertExprRhs expr =
281118+
let lazyOrAssertOrAwaitExprRhs expr =
281116281119
let optBraces, _ = ParsetreeViewer.processBracesAttr expr in
281117281120
match optBraces with
281118281121
| Some ({Location.loc = bracesLoc}, _) -> Braced bracesLoc
@@ -284490,7 +284493,7 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
284490284493
| Pexp_assert expr ->
284491284494
let rhs =
284492284495
let doc = printExpressionWithComments ~customLayout expr cmtTbl in
284493-
match Parens.lazyOrAssertExprRhs expr with
284496+
match Parens.lazyOrAssertOrAwaitExprRhs expr with
284494284497
| Parens.Parenthesized -> addParens doc
284495284498
| Braced braces -> printBraces doc expr braces
284496284499
| Nothing -> doc
@@ -284499,7 +284502,7 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
284499284502
| Pexp_lazy expr ->
284500284503
let rhs =
284501284504
let doc = printExpressionWithComments ~customLayout expr cmtTbl in
284502-
match Parens.lazyOrAssertExprRhs expr with
284505+
match Parens.lazyOrAssertOrAwaitExprRhs expr with
284503284506
| Parens.Parenthesized -> addParens doc
284504284507
| Braced braces -> printBraces doc expr braces
284505284508
| Nothing -> doc
@@ -284677,7 +284680,24 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
284677284680
in
284678284681
let exprWithAwait =
284679284682
if ParsetreeViewer.hasAwaitAttribute e.pexp_attributes then
284680-
Doc.concat [Doc.text "await "; printedExpression]
284683+
let rhs =
284684+
match
284685+
Parens.lazyOrAssertOrAwaitExprRhs
284686+
{
284687+
e with
284688+
pexp_attributes =
284689+
List.filter
284690+
(function
284691+
| {Location.txt = "res.await" | "ns.braces"}, _ -> false
284692+
| _ -> true)
284693+
e.pexp_attributes;
284694+
}
284695+
with
284696+
| Parens.Parenthesized -> addParens printedExpression
284697+
| Braced braces -> printBraces printedExpression e braces
284698+
| Nothing -> printedExpression
284699+
in
284700+
Doc.concat [Doc.text "await "; rhs]
284681284701
else printedExpression
284682284702
in
284683284703
let shouldPrintItsOwnAttributes =
@@ -285075,11 +285095,7 @@ and printBinaryExpression ~customLayout (expr : Parsetree.expression) cmtTbl =
285075285095
{
285076285096
expr with
285077285097
pexp_attributes =
285078-
List.filter
285079-
(fun attr ->
285080-
match attr with
285081-
| {Location.txt = "ns.braces"}, _ -> false
285082-
| _ -> true)
285098+
ParsetreeViewer.filterPrintableAttributes
285083285099
expr.pexp_attributes;
285084285100
}
285085285101
with

0 commit comments

Comments
 (0)