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`.
2025-03-15 01:29:58 -07:00
ds5678
cbe8dd43d7
Fix null check in MatchLegacySwitchOnStringWithDict
...
Updated the condition for `nullValueCaseBlock` to ensure it is not null and not equal to `defaultBlock`.
2025-03-09 21:00:36 -07:00
Siegfried Pammer
e1e2f739f6
Fix switch-on-string transform for optimized Roslyn.
2025-01-05 20:21:15 +01:00
Siegfried Pammer
969e3e546a
Add support for switch on (ReadOnly)Span<char> using a compiler-generated hash function.
2024-03-29 21:20:58 +01:00
Siegfried Pammer
4ca9fddd6f
Fix #3069 : Reuse SwitchAnalysis instead of MatchIfElseOnCharBlock
2023-09-03 22:13:02 +02:00
Siegfried Pammer
70616b301c
Implement support for C# 11 switch on (ReadOnly)Span<char>.
2023-08-17 00:16:41 +02:00
Siegfried Pammer
32e04eaf12
Implement Roslyn 4.6 pattern for C# switch on string: match by length and unique characters first.
2023-07-25 19:10:47 +02:00
Siegfried Pammer
35aea3eea7
Slight pattern changes in mcs 5 switch-on-string with case null.
2021-11-17 22:25:58 +01:00
Siegfried Pammer
0ed191617e
Fix #2528 : arbitrary stores preceding switch-on-string confuse the transform, making it pick the wrong variable as switch variable.
2021-10-29 23:11:01 +02:00
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;
...
```
2021-01-23 16:55:51 +01:00
Siegfried Pammer
2530c9a2ce
#2182 : Do not inline switch value, in case variable is reused.
2020-10-07 22:38:34 +02:00
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
2020-08-28 01:05:38 +02:00
Siegfried Pammer
e320819103
Formatting change: while-condition loop to do-while loop.
2020-08-27 16:25:43 +02:00
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
2020-08-27 16:11:17 +02:00
Siegfried Pammer
b27f08621f
Fix #2101 : reset removeExtraLoad flag if keepAssignmentBefore is set; implement simple case-de-duplication: abort if there are any duplicate cases.
2020-08-17 15:03:32 +02:00
Daniel Grunwald
2acc4339df
#2058 : Mark most transforms as public to help users that use the ILAst directly without decompiling to C#.
2020-07-22 21:25:22 +02:00
Daniel Grunwald
15f638af9a
Fix decompilation of switch where default section is a leave instruction.
2020-06-23 23:35:15 +02:00
Daniel Grunwald
a6e23d1f98
Fix "case null" handling in switch(string) with current Roslyn version (3.7.0-2.final).
2020-06-23 23:29:25 +02:00
Daniel Grunwald
30da0b7525
Add some missing checks to MatchRoslynSwitchOnString
2020-06-23 23:25:11 +02:00
Daniel Grunwald
832c18f0be
Fix #1809 : Support VB Select on string.
2019-12-05 00:18:08 +01:00
Siegfried Pammer
9a77a80e3c
Fix #1767 : Fix detection switch-on-string that uses leave instead of branch instructions.
2019-10-31 12:23:21 +01:00
Siegfried Pammer
0a432e23fb
Fix #1742 : Special case for case string.Empty generated by mcs.
2019-10-09 23:13:40 +02:00
Siegfried Pammer
cc3a0bef7e
Fix #1745 : Empty string is missing from switch result
2019-10-09 23:13:40 +02:00
Siegfried Pammer
05454bd741
Fix SwitchOnStringTransform.SimplifyCascadingIfStatements: do not remove statements unrelated to switch pattern.
2019-08-22 17:49:41 +02:00
Siegfried Pammer
bbb40ecb32
Fix #1602 : Recognize Roslyn empty string case block.
2019-08-18 18:38:55 +02:00
Siegfried Pammer
15488acdc7
Fix #1559 : switch on string inside try block.
2019-07-12 20:21:58 +02:00
Siegfried Pammer
f7641037a2
Fix #1526 : Roslyn-optimized switch at end of method uses leave instead of br.
2019-06-08 12:00:39 +02:00
Siegfried Pammer
edcf4931d0
Fix #1489 : ArgumentNullException in SwitchOnStringTransform.SimplifyCascadingIfStatements
2019-04-20 15:46:26 +02:00
Siegfried Pammer
9c62f11e51
Add new switch(string) pattern for Roslyn.
2019-03-02 22:42:34 +01:00
Siegfried Pammer
80bc89f606
Fix SwitchOnStringTransform.SimplifyCascadingIfStatements to handle newer Roslyn code-gen correctly.
2019-03-02 22:42:34 +01:00
Siegfried Pammer
c1fca21e8a
Make ILRange field private - introduce public API for IL range manipulation.
2019-02-16 20:36:17 +01:00
Siegfried Pammer
b9f179465d
Fix part 1 of #1292 : switch on string inside try-block not recognized.
2018-12-11 19:29:14 +01:00
Chicken-Bones
e9b766d708
Improve persistence of IL offsets through various transforms.
2018-10-08 21:21:55 +10:00
Daniel Grunwald
cfcb73f908
Merge branch 'PR1258'
2018-10-07 16:32:29 +02:00
Siegfried Pammer
65cf13ce27
Fix #1270 : Bad decompilation of mcs switch-on-string
2018-08-26 12:00:26 +02:00
Chicken-Bones
62b2ad4f8d
Improve UseCSharpSwitch to reduce over-aggressive use of switch producing poor quality code.
2018-08-14 11:19:09 +10:00
Siegfried Pammer
20ccd51948
Fix bug in SwitchOnStringTransform.SimplifyCascadingIfStatements: Do not eliminate unrelated stores right before the start of the switch.
2018-07-13 13:33:40 +02:00
Siegfried Pammer
dfa99a8c1f
Fix build.
2018-06-03 11:34:38 +02:00
Siegfried Pammer
abbf3d0429
Fix #1158 : C# 1 switch pattern improvement
2018-06-03 10:00:02 +02:00
Siegfried Pammer
9443983819
Fix #1144 : MatchRoslynCaseBlockHead did not handle inverse conditions properly.
2018-05-26 09:57:06 +02:00
Siegfried Pammer
644941d25b
Fix C# 1.0 switch on string transform and add tests
2018-05-11 01:10:29 +02:00
Siegfried Pammer
3eb694baee
Fix #1107 : bug in mcs switch on string detection.
2018-03-30 13:48:54 +02:00
Siegfried Pammer
b400d89f57
Fix #1076 ; improve detection of mcs switch-on-string pattern
2018-03-02 21:13:18 +01:00
Siegfried Pammer
7544eac5b4
Add support for mcs 2.6.4 switch-on-string
2018-02-27 15:33:54 +01:00
Siegfried Pammer
33c5e2d3ed
Add StackType.F4 and StackType.F8, and instructions LdcF4 and LdcF8.
2017-12-01 00:06:20 +01:00
Daniel Grunwald
2824906f8f
Code cleanup SwitchOnStringTransform.
2017-10-13 20:07:13 +02:00
Siegfried Pammer
1ac631b3f1
SwitchOnStringTransform: fix bugs in ExtractStringValuesFromInitBlock and MatchAddCall
2017-10-13 20:04:20 +02:00
Siegfried Pammer
a423e7da9c
Expand checks in ExtractStringValuesFromInitBlock and MatchAddCall
2017-10-13 19:41:31 +02:00
Siegfried Pammer
e6608832a4
Add documentation to SwitchOnStringTransform
2017-10-13 18:03:53 +02:00
Daniel Grunwald
9fcee831d2
Simplify SimplifyCascadingIfStatements
2017-10-13 16:09:01 +02:00