ds5678
e4000c8a5c
Enhance null handling in switch transformations
- Updated `Issue3421.cs`.
- Updated `MatchLegacySwitchOnStringWithDict` to check for `leaveContainer` and handle null sections accordingly.
- Introduced an overload for `AddNullSection` to accept `ILInstruction` as the body, improving flexibility.
- Modified existing `AddNullSection` to utilize the new overload, allowing for varied body types in `SwitchSection`.
5 months ago
ds5678
cbe8dd43d7
Fix null check in MatchLegacySwitchOnStringWithDict
Updated the condition for `nullValueCaseBlock` to ensure it is not null and not equal to `defaultBlock`.
5 months ago
Siegfried Pammer
e1e2f739f6
Fix switch-on-string transform for optimized Roslyn.
7 months ago
Siegfried Pammer
969e3e546a
Add support for switch on (ReadOnly)Span<char> using a compiler-generated hash function.
1 year ago
Siegfried Pammer
4ca9fddd6f
Fix #3069 : Reuse SwitchAnalysis instead of MatchIfElseOnCharBlock
2 years ago
Siegfried Pammer
70616b301c
Implement support for C# 11 switch on (ReadOnly)Span<char>.
2 years ago
Siegfried Pammer
32e04eaf12
Implement Roslyn 4.6 pattern for C# switch on string: match by length and unique characters first.
2 years ago
Siegfried Pammer
35aea3eea7
Slight pattern changes in mcs 5 switch-on-string with case null.
4 years ago
Siegfried Pammer
0ed191617e
Fix #2528 : arbitrary stores preceding switch-on-string confuse the transform, making it pick the wrong variable as switch variable.
4 years ago
Daniel Grunwald
6951ccb1a2
Fix #2260 : switch(string) transform: handle empty cases where the C# compiler optimizes out the `if`
e.g.
```
switch (<PrivateImplementationDetails>.ComputeStringHash(text2))
{
case 1288728352u:
_ = text2 == "rowno";
break;
...
```
5 years ago
Siegfried Pammer
2530c9a2ce
#2182 : Do not inline switch value, in case variable is reused.
5 years ago
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
5 years ago
Siegfried Pammer
e320819103
Formatting change: while-condition loop to do-while loop.
5 years ago
Siegfried Pammer
a6bbccae8d
Fix #2123 : switch on string detection:
1) Do not remove switchValueVar, if it is used elsewhere.
2) Support empty case blocks in SimplifyCascadingIfStatements transform
5 years ago
Siegfried Pammer
b27f08621f
Fix #2101 : reset removeExtraLoad flag if keepAssignmentBefore is set; implement simple case-de-duplication: abort if there are any duplicate cases.
5 years ago
Daniel Grunwald
2acc4339df
#2058 : Mark most transforms as public to help users that use the ILAst directly without decompiling to C#.
5 years ago
Daniel Grunwald
15f638af9a
Fix decompilation of switch where default section is a leave instruction.
5 years ago
Daniel Grunwald
a6e23d1f98
Fix "case null" handling in switch(string) with current Roslyn version (3.7.0-2.final).
5 years ago
Daniel Grunwald
30da0b7525
Add some missing checks to MatchRoslynSwitchOnString
5 years ago
Daniel Grunwald
832c18f0be
Fix #1809 : Support VB Select on string.
6 years ago
Siegfried Pammer
9a77a80e3c
Fix #1767 : Fix detection switch-on-string that uses leave instead of branch instructions.
6 years ago
Siegfried Pammer
0a432e23fb
Fix #1742 : Special case for case string.Empty generated by mcs.
6 years ago
Siegfried Pammer
cc3a0bef7e
Fix #1745 : Empty string is missing from switch result
6 years ago
Siegfried Pammer
05454bd741
Fix SwitchOnStringTransform.SimplifyCascadingIfStatements: do not remove statements unrelated to switch pattern.
6 years ago
Siegfried Pammer
bbb40ecb32
Fix #1602 : Recognize Roslyn empty string case block.
6 years ago
Siegfried Pammer
15488acdc7
Fix #1559 : switch on string inside try block.
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
edcf4931d0
Fix #1489 : ArgumentNullException in SwitchOnStringTransform.SimplifyCascadingIfStatements
6 years ago
Siegfried Pammer
9c62f11e51
Add new switch(string) pattern for Roslyn.
7 years ago
Siegfried Pammer
80bc89f606
Fix SwitchOnStringTransform.SimplifyCascadingIfStatements to handle newer Roslyn code-gen correctly.
7 years ago
Siegfried Pammer
c1fca21e8a
Make ILRange field private - introduce public API for IL range manipulation.
7 years ago
Siegfried Pammer
b9f179465d
Fix part 1 of #1292 : switch on string inside try-block not recognized.
7 years ago
Chicken-Bones
e9b766d708
Improve persistence of IL offsets through various transforms.
7 years ago
Siegfried Pammer
65cf13ce27
Fix #1270 : Bad decompilation of mcs switch-on-string
7 years ago
Chicken-Bones
62b2ad4f8d
Improve UseCSharpSwitch to reduce over-aggressive use of switch producing poor quality code.
7 years ago
Siegfried Pammer
20ccd51948
Fix bug in SwitchOnStringTransform.SimplifyCascadingIfStatements: Do not eliminate unrelated stores right before the start of the switch.
7 years ago
Siegfried Pammer
dfa99a8c1f
Fix build.
7 years ago
Siegfried Pammer
abbf3d0429
Fix #1158 : C# 1 switch pattern improvement
7 years ago
Siegfried Pammer
9443983819
Fix #1144 : MatchRoslynCaseBlockHead did not handle inverse conditions properly.
7 years ago
Siegfried Pammer
644941d25b
Fix C# 1.0 switch on string transform and add tests
7 years ago
Siegfried Pammer
3eb694baee
Fix #1107 : bug in mcs switch on string detection.
7 years ago
Siegfried Pammer
b400d89f57
Fix #1076 ; improve detection of mcs switch-on-string pattern
8 years ago
Siegfried Pammer
7544eac5b4
Add support for mcs 2.6.4 switch-on-string
8 years ago
Siegfried Pammer
33c5e2d3ed
Add StackType.F4 and StackType.F8, and instructions LdcF4 and LdcF8.
8 years ago
Daniel Grunwald
2824906f8f
Code cleanup SwitchOnStringTransform.
8 years ago
Siegfried Pammer
1ac631b3f1
SwitchOnStringTransform: fix bugs in ExtractStringValuesFromInitBlock and MatchAddCall
8 years ago
Siegfried Pammer
a423e7da9c
Expand checks in ExtractStringValuesFromInitBlock and MatchAddCall
8 years ago
Siegfried Pammer
e6608832a4
Add documentation to SwitchOnStringTransform
8 years ago
Daniel Grunwald
9fcee831d2
Simplify SimplifyCascadingIfStatements
8 years ago
Siegfried Pammer
f988c11229
Refactor SwitchOnStringTransform.Run
8 years ago