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,10 +1784,12 @@ 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()) {
stack.push(new ASTComprehension(res)); PycRef<ASTNode> res = pparams.front();
stack.push(new ASTComprehension(res));
}
} }
} }
} }