From 93caf733996f7a2a275d6ef083cf27d4a8e9bc58 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sun, 23 Jun 2024 11:57:14 -0700 Subject: [PATCH] Clean up some formatting issues --- ASTree.cpp | 31 +++++++++++++++---------------- tests/input/swap.py | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ASTree.cpp b/ASTree.cpp index 8f379bac9..f85f7f785 100644 --- a/ASTree.cpp +++ b/ASTree.cpp @@ -1883,8 +1883,8 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) case Pyc::SET_LINENO_A: // Ignore break; - case::Pyc::WITH_EXCEPT_START: case Pyc::SETUP_WITH_A: + case Pyc::WITH_EXCEPT_START: { PycRef withblock = new ASTWithBlock(pos+operand); blocks.push(withblock); @@ -2465,23 +2465,22 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) stack.pop(); break; case Pyc::SWAP_A: - { - unpack = operand; - ASTTuple::value_t values; - ASTTuple::value_t next_tuple; - values.resize(operand); - for (int i = 0; i < operand; i++) { - values[operand - i - 1] = stack.top(); - stack.pop(); + unpack = operand; + ASTTuple::value_t values; + ASTTuple::value_t next_tuple; + values.resize(operand); + for (int i = 0; i < operand; i++) { + values[operand - i - 1] = stack.top(); + stack.pop(); + } + auto tup = new ASTTuple(values); + tup->setRequireParens(false); + auto next_tup = new ASTTuple(next_tuple); + next_tup->setRequireParens(false); + stack.push(tup); + stack.push(next_tup); } - auto tup = new ASTTuple(values); - tup->setRequireParens(false); - auto next_tup = new ASTTuple(next_tuple); - next_tup->setRequireParens(false); - stack.push(tup); - stack.push(next_tup); - } break; default: fprintf(stderr, "Unsupported opcode: %s\n", Pyc::OpcodeName(opcode & 0xFF)); diff --git a/tests/input/swap.py b/tests/input/swap.py index 2ee3328d5..cc0bbe42e 100644 --- a/tests/input/swap.py +++ b/tests/input/swap.py @@ -9,4 +9,4 @@ def SWAP(): 8] i = 1 j = 3 - my_array[i], my_array[j], my_array[2] = my_array[j], my_array[i], my_array[4] \ No newline at end of file + my_array[i], my_array[j], my_array[2] = my_array[j], my_array[i], my_array[4]