Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-5502

Add new $let simplifications to AstSimplifier and remove UseVarIfNotSimple

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 3.2.0
    • Component/s: Linq
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Currently the UseVarIfNotSimple method returns `null` for the binding if the value is simple, and later `AstExpression.Let` has special logic for skipping any binding that is `null`.

      It would be simpler and generalize better if we moved the simplification of `$let` to the `AstSimplifier`. The simplification consists of removing any bindings where the value is "simple" and replacing var references with the simple expression. In many cases this will mean that the `$let` can be entirely optimized away. And even when not, it will likely result in fewer variables being needed.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None