pascalabcnet/AdditionalLanguages/SPython/SyntaxTreeConverters/SPythonStandardTreeConverter/BitwiseAssignmentDesugarVisitor.cs
Александр Земляк 17f6a9b956
Spython test suite (#3362)
* Reorganize files in TestSuite dir for multiple languages

* Add SPython samples to TestSuite

* Update TestRunner to support multiple languages

* Delete dll files accidentally pushed

* Update .gitignore

* Revert "Delete dll files accidentally pushed"

This reverts commit 62bcba2b821d58ae51ec98e9dadcf621bb0fc003.

* Update testing dir path in Testing.cs

* Improve TestRunner output

* Add random module and it's usage sample

* Reorganize gitignore files

* Move pascal tests back to TestSuite and create new TestSuiteLanguagePlugins folder for SPython

* Revert "Update testing dir path in Testing.cs"

This reverts commit 7d94eafb25292421bce8315520b4f6a0de001bbd.

* Revert crlf changes in pascal tests

* Test changes of _RebuildReleaseAndRunTestsForGitHubActions.bat

* Revert "Test changes of _RebuildReleaseAndRunTestsForGitHubActions.bat"

This reverts commit 234ceae3e3a339fbc68a6170e2bd201dab14d67d.

* Test changes in StorageLocationPicker

* Another test changes in StorageLocationPicker.cs

* Rename LanguagePlugins folder to AdditionalLanguages

* Decouple TestRunner from language names and parameters

* Revert calling TestRunner without parameters in .bat files

* Fix formatter tests nogui exception handling

* Small refactoring in Testing.cs and TestRunner fix of working directory
2025-12-21 21:11:52 +03:00

47 lines
1.7 KiB
C#

using PascalABCCompiler.SyntaxTree;
using PascalABCCompiler.SyntaxTreeConverters;
using System;
namespace Languages.SPython.Frontend.Converters
{
internal class BitwiseAssignmentDesugarVisitor : BaseChangeVisitor
{
public BitwiseAssignmentDesugarVisitor() { }
public override void visit(assign _assign)
{
Operators bin_op_type;
switch (_assign.operator_type)
{
case Operators.AssignmentBitwiseAND: {
bin_op_type = Operators.LogicalAND;
break; }
case Operators.AssignmentBitwiseOR: {
bin_op_type = Operators.LogicalOR;
break; }
case Operators.AssignmentBitwiseXOR: {
bin_op_type = Operators.BitwiseXOR;
break; }
case Operators.AssignmentBitwiseLeftShift: {
bin_op_type = Operators.BitwiseLeftShift;
break; }
case Operators.AssignmentBitwiseRightShift: {
bin_op_type = Operators.BitwiseRightShift;
break; }
case Operators.AssignmentIntDivision: {
bin_op_type = Operators.IntegerDivision;
break;
}
default: {
return; }
}
SourceContext sc = _assign.source_context;
bin_expr from = new bin_expr(_assign.to.TypedClone(), _assign.from, bin_op_type, sc);
assign new_assign = new assign(_assign.to, from, sc);
Replace(_assign, new_assign);
}
}
}