hazzik / DelegateDecompiler

A library which is able to decompile a delegate or a method body to its lambda representation
MIT License
522 stars 62 forks source link

Feat - extending decompilation to referenced queries #215

Open magicmoux opened 1 year ago

magicmoux commented 1 year ago

@hazzik here's PR #209 merged directly into OtpimzeExpressionVisitor.cs

Once again, I committed the unit tests first for demonstration.

hazzik commented 1 year ago

@magicmoux please rebase.

hazzik commented 1 year ago

I've fixed majority of the cases except EF tests. Also, it seems that decompilation here is going too far and maybe undesirable for some users.

magicmoux commented 1 year ago

The nesting handling is so simple that I did not see it sitting right in front of me

Also, it seems that decompilation here is going too far and maybe undesirable for some users.

I suppose you're talking about the fact that the solution provided here assumes that any IQueryable referenced by fields or local variables would be forcibly decompiled ?

magicmoux commented 1 year ago

@hazzik rebased and I restricted dereferencing queryables only to explicitly decompiled instances (also applied this to the EF tests) This helps reflect the DecompileAttribute usage (which is not applicable in those cases) for local variables and class fields.

hazzik commented 1 year ago

I suppose you're talking about the fact that the solution provided here assumes that any IQueryable referenced by fields or local variables would be forcibly decompiled ?

yes