Skip to content

Commit a9f08ae

Browse files
committed
Add comments to explain the meaning of the new flags
1 parent 47429e6 commit a9f08ae

File tree

2 files changed

+32
-19
lines changed

2 files changed

+32
-19
lines changed

src/Compiler/SyntaxTree/ParseHelpers.fs

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,14 +1110,22 @@ let mkLetExpression
11101110
trivia = trivia
11111111
)
11121112

1113-
let trivia: SynExprLetOrUseTrivia =
1114-
{
1115-
LetOrUseKeyword = mKeyword
1116-
InKeyword = mIn
1117-
EqualsRange = mEquals
1118-
}
1113+
SynExpr.LetOrUse(
1114+
isRecursive = false,
1115+
isUse = isUse,
1116+
isFromSource = true,
1117+
isComputed = true,
1118+
bindings = binding :: andBangs,
1119+
body = body,
1120+
range = mWhole,
1121+
trivia =
1122+
{
1123+
LetOrUseKeyword = mKeyword
1124+
InKeyword = mIn
1125+
EqualsRange = mEquals
1126+
}
1127+
)
11191128

1120-
SynExpr.LetOrUse(false, isUse, true, true, binding :: andBangs, body, mWhole, trivia)
11211129
| None -> SynExpr.FromParseError(body, mWhole)
11221130
else
11231131
match bindingInfo with
@@ -1151,17 +1159,18 @@ let mkLetExpression
11511159
| _ -> None
11521160

11531161
SynExpr.LetOrUse(
1154-
isRec,
1155-
isUse,
1156-
true,
1157-
false,
1158-
decls,
1159-
body,
1160-
mWhole,
1161-
{
1162-
LetOrUseKeyword = mLetOrUse
1163-
InKeyword = mIn'
1164-
EqualsRange = mEquals
1165-
}
1162+
isRecursive = isRec,
1163+
isUse = isUse,
1164+
isFromSource = true,
1165+
isComputed = false,
1166+
bindings = decls,
1167+
body = body,
1168+
range = mWhole,
1169+
trivia =
1170+
{
1171+
LetOrUseKeyword = mLetOrUse
1172+
InKeyword = mIn'
1173+
EqualsRange = mEquals
1174+
}
11661175
)
11671176
| None -> SynExpr.FromParseError(body, mWhole)

src/Compiler/SyntaxTree/SyntaxTree.fsi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,9 +882,13 @@ type SynExpr =
882882
/// F# syntax: use! pat = expr in expr
883883
/// F# syntax: let! pat = expr and! ... and! ... and! pat = expr in expr
884884
| LetOrUse of
885+
// isRecursive: true for 'let rec' and 'use rec' bindings, false for 'let' and 'use' bindings
885886
isRecursive: bool *
887+
/// isUse: true for 'use' and 'use!' bindings, false for 'let' and 'let!'
886888
isUse: bool *
889+
// isFromSource: flag indicates whether a binding was explicitly written by the user in the source code versus generated by the compiler during transformations.
887890
isFromSource: bool *
891+
// isComputed: true for 'let!' and 'use!' bindings, false for 'let' and 'use' bindings
888892
isComputed: bool *
889893
bindings: SynBinding list *
890894
body: SynExpr *

0 commit comments

Comments
 (0)