mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Apply De Morgan's to simplify negations
This commit is contained in:
@@ -418,7 +418,9 @@ partial class Decompiler
|
|||||||
goto defaultCase;
|
goto defaultCase;
|
||||||
|
|
||||||
SyntaxKind notOperatorToken;
|
SyntaxKind notOperatorToken;
|
||||||
switch (binaryExpression.OperatorToken.Kind())
|
var operatorToken = binaryExpression.OperatorToken.Kind();
|
||||||
|
|
||||||
|
switch (operatorToken)
|
||||||
{
|
{
|
||||||
case SyntaxKind.EqualsEqualsToken:
|
case SyntaxKind.EqualsEqualsToken:
|
||||||
notOperatorToken = SyntaxKind.ExclamationEqualsToken;
|
notOperatorToken = SyntaxKind.ExclamationEqualsToken;
|
||||||
@@ -440,6 +442,15 @@ partial class Decompiler
|
|||||||
notOperatorToken = SyntaxKind.LessThanToken;
|
notOperatorToken = SyntaxKind.LessThanToken;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SyntaxKind.AmpersandAmpersandToken:
|
||||||
|
case SyntaxKind.BarBarToken:
|
||||||
|
// Apply De Morgan's laws
|
||||||
|
notOperatorToken = operatorToken is SyntaxKind.AmpersandAmpersandToken
|
||||||
|
? SyntaxKind.LogicalOrExpression : SyntaxKind.LogicalAndExpression;
|
||||||
|
return BinaryExpression(notOperatorToken,
|
||||||
|
LogicalNotOf(binaryExpression.Left),
|
||||||
|
LogicalNotOf(binaryExpression.Right));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
goto defaultCase;
|
goto defaultCase;
|
||||||
}
|
}
|
||||||
@@ -447,7 +458,7 @@ partial class Decompiler
|
|||||||
return binaryExpression.WithOperatorToken(Token(notOperatorToken));
|
return binaryExpression.WithOperatorToken(Token(notOperatorToken));
|
||||||
|
|
||||||
defaultCase:
|
defaultCase:
|
||||||
return PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, originalExpression);
|
return PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, ParenthesizedExpression(originalExpression));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SyntaxKind OperationToSyntaxKind(OperationType operation)
|
private static SyntaxKind OperationToSyntaxKind(OperationType operation)
|
||||||
|
|||||||
@@ -837,7 +837,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zuneUI:ZuneShell.DefaultInstance.CurrentPage is zuneUI:QuickplayPage || zuneUI:ZuneShell.DefaultInstance.CurrentPage is zuneUI:StartupPage && string.IsNullOrEmpty(zuneUI:Shell.SessionStartupPath) && configuration:ClientConfiguration.Shell.StartupPage == zuneUI:Shell.MainFrame.Quickplay.DefaultUIPath)
|
if (zuneUI:ZuneShell.DefaultInstance.CurrentPage is not zuneUI:QuickplayPage && zuneUI:ZuneShell.DefaultInstance.CurrentPage is not zuneUI:StartupPage || !(string.IsNullOrEmpty(zuneUI:Shell.SessionStartupPath)) || configuration:ClientConfiguration.Shell.StartupPage != zuneUI:Shell.MainFrame.Quickplay.DefaultUIPath)
|
||||||
{
|
{
|
||||||
if (zuneUI:ZuneShell.DefaultInstance.CurrentPage is zuneUI:StartupPage)
|
if (zuneUI:ZuneShell.DefaultInstance.CurrentPage is zuneUI:StartupPage)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user