Skip to content

Commit 2420fd1

Browse files
committed
One more syntax sync.
1 parent 57758b1 commit 2420fd1

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269911,6 +269911,7 @@ val hasOptionalAttribute : Parsetree.attributes -> bool
269911269911
val shouldIndentBinaryExpr : Parsetree.expression -> bool
269912269912
val shouldInlineRhsBinaryExpr : Parsetree.expression -> bool
269913269913
val hasPrintableAttributes : Parsetree.attributes -> bool
269914+
val filterPrintableAttributes : Parsetree.attributes -> Parsetree.attributes
269914269915
val partitionPrintableAttributes :
269915269916
Parsetree.attributes -> Parsetree.attributes * Parsetree.attributes
269916269917

@@ -270500,6 +270501,8 @@ let isPrintableAttribute attr =
270500270501

270501270502
let hasPrintableAttributes attrs = List.exists isPrintableAttribute attrs
270502270503

270504+
let filterPrintableAttributes attrs = List.filter isPrintableAttribute attrs
270505+
270503270506
let partitionPrintableAttributes attrs =
270504270507
List.partition isPrintableAttribute attrs
270505270508

@@ -275160,7 +275163,7 @@ val subBinaryExprOperand : string -> string -> bool
275160275163
val rhsBinaryExprOperand : string -> Parsetree.expression -> bool
275161275164
val flattenOperandRhs : string -> Parsetree.expression -> bool
275162275165

275163-
val lazyOrAssertExprRhs : Parsetree.expression -> kind
275166+
val lazyOrAssertOrAwaitExprRhs : Parsetree.expression -> kind
275164275167

275165275168
val fieldExpr : Parsetree.expression -> kind
275166275169

@@ -275364,7 +275367,7 @@ let flattenOperandRhs parentOperator rhs =
275364275367
| _ when ParsetreeViewer.isTernaryExpr rhs -> true
275365275368
| _ -> false
275366275369

275367-
let lazyOrAssertExprRhs expr =
275370+
let lazyOrAssertOrAwaitExprRhs expr =
275368275371
let optBraces, _ = ParsetreeViewer.processBracesAttr expr in
275369275372
match optBraces with
275370275373
| Some ({Location.loc = bracesLoc}, _) -> Braced bracesLoc
@@ -278742,7 +278745,7 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
278742278745
| Pexp_assert expr ->
278743278746
let rhs =
278744278747
let doc = printExpressionWithComments ~customLayout expr cmtTbl in
278745-
match Parens.lazyOrAssertExprRhs expr with
278748+
match Parens.lazyOrAssertOrAwaitExprRhs expr with
278746278749
| Parens.Parenthesized -> addParens doc
278747278750
| Braced braces -> printBraces doc expr braces
278748278751
| Nothing -> doc
@@ -278751,7 +278754,7 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
278751278754
| Pexp_lazy expr ->
278752278755
let rhs =
278753278756
let doc = printExpressionWithComments ~customLayout expr cmtTbl in
278754-
match Parens.lazyOrAssertExprRhs expr with
278757+
match Parens.lazyOrAssertOrAwaitExprRhs expr with
278755278758
| Parens.Parenthesized -> addParens doc
278756278759
| Braced braces -> printBraces doc expr braces
278757278760
| Nothing -> doc
@@ -278929,7 +278932,24 @@ and printExpression ~customLayout (e : Parsetree.expression) cmtTbl =
278929278932
in
278930278933
let exprWithAwait =
278931278934
if ParsetreeViewer.hasAwaitAttribute e.pexp_attributes then
278932-
Doc.concat [Doc.text "await "; printedExpression]
278935+
let rhs =
278936+
match
278937+
Parens.lazyOrAssertOrAwaitExprRhs
278938+
{
278939+
e with
278940+
pexp_attributes =
278941+
List.filter
278942+
(function
278943+
| {Location.txt = "res.await" | "ns.braces"}, _ -> false
278944+
| _ -> true)
278945+
e.pexp_attributes;
278946+
}
278947+
with
278948+
| Parens.Parenthesized -> addParens printedExpression
278949+
| Braced braces -> printBraces printedExpression e braces
278950+
| Nothing -> printedExpression
278951+
in
278952+
Doc.concat [Doc.text "await "; rhs]
278933278953
else printedExpression
278934278954
in
278935278955
let shouldPrintItsOwnAttributes =
@@ -279327,11 +279347,7 @@ and printBinaryExpression ~customLayout (expr : Parsetree.expression) cmtTbl =
279327279347
{
279328279348
expr with
279329279349
pexp_attributes =
279330-
List.filter
279331-
(fun attr ->
279332-
match attr with
279333-
| {Location.txt = "ns.braces"}, _ -> false
279334-
| _ -> true)
279350+
ParsetreeViewer.filterPrintableAttributes
279335279351
expr.pexp_attributes;
279336279352
}
279337279353
with

0 commit comments

Comments
 (0)