@@ -4131,12 +4131,15 @@ sequentialExpr:
4131
4131
SynExpr.Sequential(DebugPointAtSequential.SuppressNeither, false, $1, $4, unionRanges $1.Range $4.Range, trivia) }
4132
4132
4133
4133
| hardwhiteLetBindings %prec prec_args_error
4134
- { let hwlb , m, mIn = $1
4135
- let mLetKwd, isUse = match hwlb with (BindingSetPreAttrs(m, _, isUse, _, _)) -> m, isUse
4134
+ { let bindingSet , m, mIn = $1
4135
+ let mLetKwd, isUse = match bindingSet with (BindingSetPreAttrs(m, _, isUse, _, _)) -> m, isUse
4136
4136
let usedKeyword = if isUse then "use" else "let"
4137
4137
reportParseErrorAt mLetKwd (FSComp.SR.parsExpectedExpressionAfterLet(usedKeyword, usedKeyword))
4138
4138
let fauxRange = m.EndRange // zero width range at end of m
4139
- mkLocalBindings (m, hwlb, mIn, arbExpr ("seqExpr", fauxRange)) }
4139
+ // Extract isRec from BindingSetPreAttrs
4140
+ let isRec = match bindingSet with BindingSetPreAttrs(_, isRec, _, _, _) -> isRec
4141
+ // Use mkLetExpression for both let and use expressions
4142
+ mkLetExpression(false, mLetKwd, mIn, m, arbExpr ("seqExpr", fauxRange), Some(isRec, bindingSet), None) }
4140
4143
4141
4144
/* Use this as the last terminal when performing error recovery */
4142
4145
/* The contract for using this is that (a) if EOF occurs then the */
@@ -4161,15 +4164,12 @@ moreBinders:
4161
4164
if isInline then errorR(Error(FSComp.SR.parsInvalidDeclarationSyntax(), rhs parseState 2))
4162
4165
if isMutable then errorR(Error(FSComp.SR.parsInvalidDeclarationSyntax(), rhs parseState 2))
4163
4166
4167
+ let mKeyword = rhs parseState 1
4164
4168
let mEquals = rhs parseState 3
4165
- let m = unionRanges (rhs parseState 1) $4.Range
4166
- // Debug point should span the entire binding: from AND_BANG through the expression
4167
- let spBind = DebugPointAtBinding.Yes(m)
4168
- let mIn = rhs parseState 5
4169
- let trivia = { AndBangKeyword = rhs parseState 1; EqualsRange = mEquals; InKeyword = Some mIn }
4169
+ let m = unionRanges mKeyword $4.Range
4170
+ let mIn = Some(rhs parseState 5)
4170
4171
4171
- // Note: For and!, we always use isRecursive=false and isUse=true
4172
- SynExprAndBang(spBind, false, true, pat, $4, m, trivia) :: $6 }
4172
+ mkAndBang(mKeyword, pat, $4, m, mEquals, mIn) :: $6 }
4173
4173
4174
4174
| OAND_BANG ceBindingCore EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders %prec expr_let
4175
4175
{ // Offside-sensitive version of and! binding
@@ -4181,47 +4181,69 @@ moreBinders:
4181
4181
4182
4182
let report, mIn, _ = $5
4183
4183
report "and!" (rhs parseState 1) // report unterminated error
4184
+ let mKeyword = rhs parseState 1
4184
4185
let mEquals = rhs parseState 3
4185
- let m = unionRanges (rhs parseState 1) $4.Range
4186
- // Debug point should span the entire binding: from OAND_BANG through the expression
4187
- let spBind = DebugPointAtBinding.Yes(m)
4188
- let trivia = { AndBangKeyword = rhs parseState 1; EqualsRange = mEquals; InKeyword = mIn }
4186
+ let m = unionRanges mKeyword $4.Range
4189
4187
4190
- // Note: For and!, we always use isRecursive=false and isUse=true
4191
- SynExprAndBang(spBind, false, true, pat, $4, m, trivia) :: $7 }
4188
+ mkAndBang(mKeyword, pat, $4, m, mEquals, mIn) :: $7 }
4192
4189
4193
4190
| %prec prec_no_more_attr_bindings
4194
4191
{ [] }
4195
4192
4196
4193
declExpr:
4197
4194
| defnBindings IN typedSequentialExpr %prec expr_let
4198
4195
{ let mIn = rhs parseState 2 |> Some
4199
- mkLocalBindings (unionRanges (rhs2 parseState 1 2) $3.Range, $1, mIn, $3) }
4196
+ let mWhole = unionRanges (rhs2 parseState 1 2) $3.Range
4197
+ let bindingSet = $1
4198
+ // Extract isRec and mKeyword from BindingSetPreAttrs
4199
+ let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec
4200
+ // Use mkLetExpression for both let and use expressions
4201
+ mkLetExpression(false, mKeyword, mIn, mWhole, $3, Some(isRec, bindingSet), None) }
4200
4202
4201
4203
| defnBindings IN error %prec expr_let
4202
4204
{ let mIn = rhs parseState 2 |> Some
4203
- mkLocalBindings (rhs2 parseState 1 2, $1, mIn, arbExpr ("declExpr1", (rhs parseState 3))) }
4205
+ let mWhole = rhs2 parseState 1 2
4206
+ let bindingSet = $1
4207
+ // Extract isRec and mKeyword from BindingSetPreAttrs
4208
+ let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec
4209
+ // Use mkLetExpression for both let and use expressions
4210
+ mkLetExpression(false, mKeyword, mIn, mWhole, arbExpr ("declExpr1", (rhs parseState 3)), Some(isRec, bindingSet), None) }
4204
4211
/*
4205
4212
FSComp.SR.parsNoMatchingInForLet() -- leave this in for now - it's an unused error string
4206
4213
*/
4207
4214
4208
4215
| hardwhiteLetBindings typedSequentialExprBlock %prec expr_let
4209
- { let hwlb, m, mIn = $1
4210
- mkLocalBindings (unionRanges m $2.Range, hwlb, mIn, $2) }
4216
+ { let bindingSet, m, mIn = $1
4217
+ let mWhole = unionRanges m $2.Range
4218
+ // Extract isRec and mKeyword from BindingSetPreAttrs
4219
+ let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec
4220
+ // Use mkLetExpression for both let and use expressions
4221
+ mkLetExpression(false, mKeyword, mIn, mWhole, $2, Some(isRec, bindingSet), None) }
4211
4222
4212
4223
| hardwhiteLetBindings error %prec expr_let
4213
- { let hwlb, m, mIn = $1
4214
- reportParseErrorAt (match hwlb with (BindingSetPreAttrs(m, _, _, _, _)) -> m) (FSComp.SR.parsErrorInReturnForLetIncorrectIndentation())
4215
- mkLocalBindings (m, hwlb, mIn, arbExpr ("declExpr2", (rhs parseState 2))) }
4224
+ { let bindingSet, m, mIn = $1
4225
+ reportParseErrorAt (match bindingSet with (BindingSetPreAttrs(m, _, _, _, _)) -> m) (FSComp.SR.parsErrorInReturnForLetIncorrectIndentation())
4226
+ // Extract isRec and mKeyword from BindingSetPreAttrs
4227
+ let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec
4228
+ // Use mkLetExpression for both let and use expressions
4229
+ mkLetExpression(false, mKeyword, mIn, m, arbExpr ("declExpr2", (rhs parseState 2)), Some(isRec, bindingSet), None) }
4216
4230
4217
4231
| hardwhiteLetBindings OBLOCKSEP typedSequentialExprBlock %prec expr_let
4218
- { let hwlb, m, mIn = $1
4219
- mkLocalBindings (unionRanges m $3.Range, hwlb, mIn, $3) }
4232
+ { let bindingSet, m, mIn = $1
4233
+ let mWhole = unionRanges m $3.Range
4234
+ // Extract isRec and mKeyword from BindingSetPreAttrs
4235
+ let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec
4236
+ // Use mkLetExpression for both let and use expressions
4237
+ mkLetExpression(false, mKeyword, mIn, mWhole, $3, Some(isRec, bindingSet), None) }
4220
4238
4221
4239
| hardwhiteLetBindings OBLOCKSEP error %prec expr_let
4222
- { let hwlb, m, mIn = $1
4223
- //reportParseErrorAt (match hwlb with (BindingSetPreAttrs(m, _, _, _, _)) -> m) (FSComp.SR.parsErrorInReturnForLetIncorrectIndentation())
4224
- mkLocalBindings (unionRanges m (rhs parseState 3), hwlb, mIn, arbExpr ("declExpr3", (rhs parseState 3))) }
4240
+ { let bindingSet, m, mIn = $1
4241
+ //reportParseErrorAt (match bindingSet with (BindingSetPreAttrs(m, _, _, _, _)) -> m) (FSComp.SR.parsErrorInReturnForLetIncorrectIndentation())
4242
+ let mWhole = unionRanges m (rhs parseState 3)
4243
+ // Extract isRec and mKeyword from BindingSetPreAttrs
4244
+ let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec
4245
+ // Use mkLetExpression for both let and use expressions
4246
+ mkLetExpression(false, mKeyword, mIn, mWhole, arbExpr ("declExpr3", (rhs parseState 3)), Some(isRec, bindingSet), None) }
4225
4247
4226
4248
| hardwhiteDoBinding %prec expr_let
4227
4249
{ let (BindingSetPreAttrs(_, _, _, _, m)), e = $1
@@ -4555,15 +4577,15 @@ declExpr:
4555
4577
if isInline then errorR(Error(FSComp.SR.parsInvalidDeclarationSyntax(), rhs parseState 2))
4556
4578
if isMutable then errorR(Error(FSComp.SR.parsInvalidDeclarationSyntax(), rhs parseState 2))
4557
4579
4558
- let mEquals = rhs parseState 3
4559
- let m = unionRanges (rhs parseState 1) $8.Range
4560
- // Debug point should span from BINDER through the expression (but not the continuation)
4561
- let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range)
4562
- let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals }
4580
+ let mKeyword = rhs parseState 1
4581
+ let mEquals = Some(rhs parseState 3)
4582
+ let m = unionRanges mKeyword $8.Range
4563
4583
4564
- // $1 contains the actual keyword ("let! " or "use! ")
4584
+ // $1 contains the actual keyword ("let" or "use")
4565
4585
let isUse = ($1 = "use")
4566
- SynExpr.LetOrUseBang(spBind, isUse, true, pat, $4, $7, $8, m, trivia) }
4586
+
4587
+ // Use mkLetExpression for both let! and use! bindings
4588
+ mkLetExpression(true, mKeyword, None, m, $8, None, Some(pat, $4, $7, mEquals, isUse)) }
4567
4589
4568
4590
| OBINDER ceBindingCore EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let
4569
4591
{ // Offside-sensitive version of let!/use! binding
@@ -4575,14 +4597,14 @@ declExpr:
4575
4597
4576
4598
let report, mIn, _ = $5
4577
4599
report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error
4578
- let mEquals = rhs parseState 3
4579
- let m = unionRanges (rhs parseState 1) $8.Range
4580
- // Debug point should span from OBINDER through the expression (but not the continuation)
4581
- let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range)
4582
- let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals }
4600
+ let mKeyword = rhs parseState 1
4601
+ let mEquals = Some(rhs parseState 3)
4602
+ let m = unionRanges mKeyword $8.Range
4583
4603
4584
4604
let isUse = ($1 = "use")
4585
- SynExpr.LetOrUseBang(spBind, isUse, true, pat, $4, $7, $8, m, trivia) }
4605
+
4606
+ // Use mkLetExpression for both let! and use! bindings
4607
+ mkLetExpression(true, mKeyword, None, m, $8, None, Some(pat, $4, $7, mEquals, isUse)) }
4586
4608
4587
4609
| OBINDER ceBindingCore EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let
4588
4610
{ // Error recovery for incomplete let!/use! bindings
@@ -4593,16 +4615,16 @@ declExpr:
4593
4615
if isInline then errorR(Error(FSComp.SR.parsInvalidDeclarationSyntax(), rhs parseState 2))
4594
4616
if isMutable then errorR(Error(FSComp.SR.parsInvalidDeclarationSyntax(), rhs parseState 2))
4595
4617
4596
- // Debug point should span from OBINDER through the expression
4597
- let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range)
4598
- let mEquals = rhs parseState 3
4599
- let mAll = unionRanges (rhs parseState 1) (rhs parseState 7)
4618
+ let mKeyword = rhs parseState 1
4619
+ let mEquals = Some(rhs parseState 3)
4620
+ let mAll = unionRanges mKeyword (rhs parseState 7)
4600
4621
let m = $4.Range.EndRange // zero-width range
4601
- let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals }
4602
4622
4603
4623
let isUse = ($1 = "use")
4624
+
4604
4625
// Use ImplicitZero as the continuation expression for error recovery
4605
- SynExpr.LetOrUseBang(spBind, isUse, true, pat, $4, [], SynExpr.ImplicitZero m, mAll, trivia) }
4626
+ // Use mkLetExpression for both let! and use! bindings
4627
+ mkLetExpression(true, mKeyword, None, mAll, SynExpr.ImplicitZero m, None, Some(pat, $4, [], mEquals, isUse)) }
4606
4628
4607
4629
| DO_BANG typedSequentialExpr IN opt_OBLOCKSEP typedSequentialExprBlock %prec expr_let
4608
4630
{ let spBind = DebugPointAtBinding.NoneAtDo
0 commit comments