Skip to content

Commit

Permalink
Clean up some formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zrax committed Jun 23, 2024
1 parent e1ac2ad commit 93caf73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
31 changes: 15 additions & 16 deletions ASTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1883,8 +1883,8 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> 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<ASTBlock> withblock = new ASTWithBlock(pos+operand);
blocks.push(withblock);
Expand Down Expand Up @@ -2465,23 +2465,22 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> 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));
Expand Down
2 changes: 1 addition & 1 deletion tests/input/swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
my_array[i], my_array[j], my_array[2] = my_array[j], my_array[i], my_array[4]

0 comments on commit 93caf73

Please sign in to comment.