Adjust to reduce duplication

This commit is contained in:
Michael Hansen
2022-10-04 15:15:02 -07:00
parent e2db195b85
commit 747921a761

View File

@@ -1784,13 +1784,15 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
* If it's a comprehension, the only POP_TOP should be * If it's a comprehension, the only POP_TOP should be
* a call to append the iter to the list. * a call to append the iter to the list.
*/ */
if (value.type() == ASTNode::NODE_CALL && !value.cast<ASTCall>()->pparams().empty() ) { if (value.type() == ASTNode::NODE_CALL) {
PycRef<ASTNode> res = value.cast<ASTCall>()->pparams().front(); auto& pparams = value.cast<ASTCall>()->pparams();
if (!pparams.empty()) {
PycRef<ASTNode> res = pparams.front();
stack.push(new ASTComprehension(res)); stack.push(new ASTComprehension(res));
} }
} }
} }
}
break; break;
case Pyc::PRINT_ITEM: case Pyc::PRINT_ITEM:
{ {