-
Notifications
You must be signed in to change notification settings - Fork 847
Unify let, let!, use, use! LetOrUse AST representation.
#18816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1799aaf
55507e9
1738018
65f5bb6
0c97b9d
6f2b706
e8f1bb0
75d8f5e
4f2e97e
63be5d5
4248f2a
cc96217
e270b88
e0cc65a
1e29d58
1470bf9
8988215
74712e8
967c4a9
a30cef4
5fa0480
15e3d34
b7ffcf8
5bde641
0f7c23c
6a6843c
d11dd4a
9d3c0f5
6cf1a9c
a0005ec
f6c80c7
720eec5
d380ef0
1b2d9e5
05e88b7
ee9397a
b3db637
f960746
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -762,13 +762,11 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | |
| yield! walkExpr false e2 | ||
| yield! walkExpr false e3 | ||
|
|
||
| | SynExpr.LetOrUseBang(spBind, _, _, _, rhsExpr, andBangs, bodyExpr, _, _) -> | ||
| yield! walkBindSeqPt spBind | ||
| yield! walkExpr true rhsExpr | ||
|
|
||
| for SynBinding(debugPoint = andBangSpBind; expr = eAndBang) in andBangs do | ||
| yield! walkBindSeqPt andBangSpBind | ||
| yield! walkExpr true eAndBang | ||
| | SynExpr.LetOrUse(isComputed = true; bindings = bindings; body = bodyExpr) -> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it covered on line 700? |
||
| // Handle all bindings (first let!/use! and all and! bindings) | ||
| for SynBinding(debugPoint = spBind; expr = bindingExpr) in bindings do | ||
| yield! walkBindSeqPt spBind | ||
| yield! walkExpr true bindingExpr | ||
|
|
||
| yield! walkExpr true bodyExpr | ||
| ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -904,8 +904,16 @@ module InterfaceStubGenerator = | |
|
|
||
| | SynExpr.TypeApp(synExpr, _, _synTypeList, _commas, _, _, _range) -> walkExpr synExpr | ||
|
|
||
| | SynExpr.LetOrUse(bindings = synBindingList; body = synExpr) -> | ||
| Option.orElse (List.tryPick walkBinding synBindingList) (walkExpr synExpr) | ||
| | SynExpr.LetOrUse(isComputed = isComputed; bindings = synBindingList; body = synExpr) -> | ||
| if isComputed then | ||
| [ | ||
| for SynBinding(expr = bindingExpr) in synBindingList do | ||
| yield bindingExpr | ||
| yield synExpr | ||
| ] | ||
| |> List.tryPick walkExpr | ||
| else | ||
| Option.orElse (List.tryPick walkBinding synBindingList) (walkExpr synExpr) | ||
|
Comment on lines
+908
to
+916
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if different logic is actually needed here. Would it work as expected if we just reuse the |
||
|
|
||
| | SynExpr.TryWith(tryExpr = synExpr) -> walkExpr synExpr | ||
|
|
||
|
|
@@ -956,15 +964,6 @@ module InterfaceStubGenerator = | |
| | SynExpr.YieldOrReturnFrom(expr = synExpr) | ||
| | SynExpr.DoBang(expr = synExpr) -> walkExpr synExpr | ||
|
|
||
| | SynExpr.LetOrUseBang(rhs = synExpr1; andBangs = synExprAndBangs; body = synExpr2) -> | ||
| [ | ||
| yield synExpr1 | ||
| for SynBinding(expr = eAndBang) in synExprAndBangs do | ||
| yield eAndBang | ||
| yield synExpr2 | ||
| ] | ||
| |> List.tryPick walkExpr | ||
|
|
||
|
Comment on lines
-959
to
-967
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a suggestion in this particular case, but we could in theory match | SynExpr.LetOrUse(isComputed = true; bindings = synBindingList; body = synExpr) ->to minimize the diff in cases like this. |
||
| | SynExpr.LibraryOnlyILAssembly _ | ||
| | SynExpr.LibraryOnlyStaticOptimization _ | ||
| | SynExpr.LibraryOnlyUnionCaseFieldGet _ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, do we need to distinguish the computed variant here? I'd expect the logic from
LetOrUseto be reused.