fix: bug iin If_stmt

This commit is contained in:
2023-11-09 19:42:45 +08:00
parent f893a09ba5
commit 12ffce995b

View File

@ -202,7 +202,7 @@ std::any EvalVisitor::visitCompound_stmt(
std::any EvalVisitor::visitIf_stmt(Python3Parser::If_stmtContext *ctx) {
auto test_list = ctx->test();
auto suite_list = ctx->suite();
if (test_list.size() - suite_list.size() != 1 &&
if (test_list.size() - suite_list.size() != -1 &&
test_list.size() - suite_list.size() != 0)
throw InterpretException("test and suite doesn't match in If_stmt");
for (int i = 0; i < test_list.size(); i++)