Closed koliyo closed 3 years ago
Hi @koliyo ,
ParameterExpression[]
for AsyncLambdaExpression
and LambdaExpression
LexicalScope
is really internal thing. It is tightly coupled with thread-local storage to follow the natural flow of instructions. Leakage of this abstraction can cause unpredictable behavior. For instance, you will save the reference to the scope and share it with another thread or reuse after construction. But I can add public static CodeGenerator.AddStatement
method for the convenience.Also, could you please provide minimal example in C# for what you expected from new API?
I'm closing issue because Statement
static method has been added to release 3.3.0 and no additional feedback was received. @koliyo feel free to reopen this issue if you have a concrete suggestion about API design.
I understand wanting to keep LexicalScope an internal implementation detail.
But allowing adding statements manually instead of using CodeGenerator would be really helpful when there is a lot of existing code using standard
System.Linq.Expressions
patterns.If I could manually call
LexicalScope.Current.AddStatement
, it would save me a lot of code rewriting. And make gradual migrations to the dotNext LinqEx handling.Preferably I would like to be able to do the following:
LexicalScope
/AsyncLambdaExpression
using manually specifiedParameterExpression[]
, instead of justSystem.Type[]
LexicalScope
, specifically usingILexicalScope.AddStatement