Daniel Grunwald
8cd8a90c22
Fix #1563 : `Unexpected return in MoveNext()` when mixed `using` and more than one `yield break`
...
Roslyn re-uses the same "this.Finally(); return v;" block for both "yield break;" instructions, so the yield break pattern needs to support multiple stores to the helper variable.
6 years ago
Daniel Grunwald
539e3a906d
Fix #1552 : user-defined and decimal increments
...
For user-defined increments, there were problems with Roslyn was optimizing out one of the stores.
The new transform FixRemainingIncrements now takes increments/decrements that were not detected by TransformAssignment and introduces a temporary variable that can be incremented.
This sometimes requires un-inlining via the new ILInstruction.Extract() operation.
Extract() is not supported in all possible contexts, so it is possible but unlikely that some op_Increment calls remain.
For decimals, the situation is different: legacy csc actually was optimizing "d + 1m" to "op_Increment(d)", so we can get rid of any left-over increments by undoing this optimization. This now happens in ReplaceMethodCallsWithOperators.
6 years ago
Siegfried Pammer
61231b7725
Fix #1593 : TransformCollectionAndObjectInitializers uses nested indexer call as target of object initializer.
6 years ago
Daniel Grunwald
c56714c607
Fix assertion with async lambdas; fix async local functions.
6 years ago
Daniel Grunwald
856cedc95e
#1456 : add test case; add additional checks to ensure we only transform normal locals into using/foreach-locals
6 years ago
Daniel Grunwald
beed6b5e24
Remove MarkGeneratedVariables() step in AsyncAwaitDecompiler.
...
This was left-over from earlier versions; but ILSpy stopped caring so much about variable vs. stack slot since Roslyn started to optimize more aggressively.
The change of variable type caused problems for debug information and could even cause an assertion.
Closes #1456 , closes #1562 .
6 years ago
Siegfried Pammer
f10ab69328
Improve local-function detection to minimize false positives.
6 years ago
Siegfried Pammer
a109b77858
Refactor LocalFunctionDecompiler to allow mutually recursive local functions to be decompiled correctly.
6 years ago
Siegfried Pammer
e215f69b2d
Extend description of LocalFunctionDecompiler
6 years ago
Siegfried Pammer
37e14f43e3
Refactor/Clean up local functions representation in type system.
6 years ago
Daniel Grunwald
33c7425fa2
Fix several bugs with compound assignments on indexers.
...
Closes #1580 .
6 years ago
Siegfried Pammer
f3f38783df
ICSharpCode.Decompiler roundtrip test now completes
6 years ago
Daniel Grunwald
ccdabf2325
Fix a bunch of XmlDoc compiler warnings.
6 years ago
Daniel Grunwald
b32cae412a
Eliminate BlockKind.PostfixOperator.
...
We can now represent all compound assignments using the CompoundAssignInstruction, including those on local variables.
Closes #1583 .
6 years ago
Daniel Grunwald
f2151972a0
Redesign CompoundAssignmentInstruction to support an 'Address' mode where we don't implicitly turn an LdObj into an StObj, but instead directly operate on an address.
...
This means we can get rid of the special case in TransformDisplayClassUsage, as compound.assign can now also be used with the address of a local variable.
6 years ago
Siegfried Pammer
19a7898786
Add addressof(ldloc) => ldloca transform to EarlyExpressionTransforms
6 years ago
Siegfried Pammer
01e42b772c
Fix local functions inside lambdas.
6 years ago
Siegfried Pammer
b83cb41f2e
Add pretty tests for local functions.
6 years ago
Siegfried Pammer
6f98ed5415
Fix unit tests.
6 years ago
Siegfried Pammer
305b47245e
Refactor representation of local functions in ILAst.
6 years ago
Siegfried Pammer
b42d4963e7
Fix assertions in TransformExpressionTrees.
6 years ago
Siegfried Pammer
16d6e16da7
Add support for local function references and recursive local functions.
6 years ago
Siegfried Pammer
d50b8d66d1
Fix #1373 , fix #1541 : add support for instance calls to CallIndirect.
6 years ago
Daniel Grunwald
a6def4cdf5
Fix incorrect type for numeric.compound.assign when the pointer type is incompatible with the store type.
...
Closes #1511 , #1530 , #1533 .
6 years ago
Daniel Grunwald
ed5d71b365
Fix #1537 : KeyNotFoundException in ReduceNestingTransform.ReduceSwitchNesting()
6 years ago
Siegfried Pammer
ab892a603b
Disassembler: Refactor InstructionOutputExtensions.WriteTo: Reduce code duplication; Add support for unmanaged calling conventions
6 years ago
Siegfried Pammer
cd8dd7af9f
Disassembler: Fix output of calling convention and flags in standalone method signature
6 years ago
Siegfried Pammer
119c679fad
Add addressof(ldloc V) => ldloca V transform for read access on value types.
6 years ago
Siegfried Pammer
8d1522f387
Transform display classes used in local functions.
6 years ago
Daniel Grunwald
3314f3f37a
Fix #1571 : Expression transforms not running for values of inline assignments.
6 years ago
Siegfried Pammer
15488acdc7
Fix #1559 : switch on string inside try block.
6 years ago
Siegfried Pammer
6d05f36821
Fix #1562 : Do not transform display class initialization to object initializer.
6 years ago
Siegfried Pammer
b4a59ae4dd
Remove obsolete code from DelegateConstruction.cs
6 years ago
Siegfried Pammer
c1ac461c26
Enable MCS yield return pretty tests.
6 years ago
Siegfried Pammer
7f8856b10f
Fix #1026 : Improve support for mcs in TransformDisplayClassUsage
6 years ago
Siegfried Pammer
6a1229028c
Only try to inline stackalloc Span<T> if the next statement is a plain assignment.
6 years ago
Siegfried Pammer
9590cfbf59
Update tests to latest Roslyn implementation.
6 years ago
Siegfried Pammer
5a2302089b
Refactor TransformDisplayClassUsage into separate transform.
...
Make display class detection pattern-based instead of name-based. Fixes #1554
6 years ago
Siegfried Pammer
bd77b8301f
Basic implementation of local functions.
6 years ago
Siegfried Pammer
cf7deca7e1
Fix build.
6 years ago
Siegfried Pammer
34098b16e8
Fix #1548 : Detection of lambdas.
6 years ago
Daniel Grunwald
ab4e05f783
Don't perform DetectCatchWhenConditionBlocks transform when catchBlock.Variable.Type setter would throw an exception due to differing stack types.
6 years ago
Daniel Grunwald
877780beb5
Fix ReduceNestingTransform bug introduced in commit 7f27768ff9
6 years ago
Daniel Grunwald
7f27768ff9
Fix #1391 , #1393 , #1458 : Fix ReduceNestingTransform modifying the Blocks collection while iterating over it.
6 years ago
Siegfried Pammer
f7641037a2
Fix #1526 : Roslyn-optimized switch at end of method uses leave instead of br.
6 years ago
Siegfried Pammer
0e638dcb28
Fix #1524 : Adjust expression trees transform to work with async code as well.
6 years ago
Daniel Grunwald
961923f4fd
#1499 , #1240 : Translate pointer arithmetic on managed pointers (ref T) using the System.Runtime.CompilerServices.Unsafe intrinsics
6 years ago
Siegfried Pammer
7a976f197f
Fix #1500 : anonymous type creation expression cannot have an object initializer.
6 years ago
Siegfried Pammer
edcf4931d0
Fix #1489 : ArgumentNullException in SwitchOnStringTransform.SimplifyCascadingIfStatements
6 years ago
Siegfried Pammer
8dc80583ec
#1485 : Fix decompilation of TypeAs with Nullable<T> in expression trees
6 years ago