Add new $let simplifications to AstSimplifier and remove UseVarIfNotSimple

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: 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 Stam
            Reporter:
            Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: