This commit is contained in:
Aralox
2020-10-26 15:15:45 +11:00
parent a987c34e65
commit 23beda48d7

View File

@@ -685,8 +685,9 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
break;
case Pyc::DUP_TOP:
{
if (stack.top().type() != PycObject::TYPE_NULL) {
if (stack.top().type() == ASTNode::NODE_CHAINSTORE) {
if (stack.top().type() == PycObject::TYPE_NULL) {
stack.push(stack.top());
} else if (stack.top().type() == ASTNode::NODE_CHAINSTORE) {
auto chainstore = stack.top();
stack.pop();
stack.push(stack.top());
@@ -696,9 +697,6 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
ASTNodeList::list_t targets;
stack.push(new ASTChainStore(targets, stack.top()));
}
} else {
stack.push(stack.top());
}
}
break;
case Pyc::DUP_TOP_TWO:
@@ -2389,7 +2387,8 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
return new ASTNodeList(defblock->nodes());
}
static void append_to_chain_store(PycRef<ASTNode> chainStore, PycRef<ASTNode> item, FastStack& stack, PycRef<ASTBlock> curblock)
static void append_to_chain_store(PycRef<ASTNode> chainStore, PycRef<ASTNode> item,
FastStack& stack, PycRef<ASTBlock> curblock)
{
stack.pop(); // ignore identical source object.
chainStore.cast<ASTChainStore>()->append(item);