From 7701ed420eb2f8c619358ab9eeb8bbf151a6bd2d Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Fri, 15 Jul 2016 13:37:50 -0700 Subject: [PATCH] Make the comparison ops a bit more visually distinct --- bytecode.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bytecode.cpp b/bytecode.cpp index 925b59f..1af146b 100644 --- a/bytecode.cpp +++ b/bytecode.cpp @@ -332,6 +332,8 @@ void bc_disasm(PycRef code, PycModule* mod, int indent) "<", "<=", "==", "!=", ">", ">=", "in", "not in", "is", "is not", "", "" }; + static const ssize_t cmp_strings_len = sizeof(cmp_strings) / sizeof(cmp_strings[0]); + PycBuffer source(code->code()->value(), code->code()->length()); int opcode, operand; @@ -358,11 +360,10 @@ void bc_disasm(PycRef code, PycModule* mod, int indent) } else if (Pyc::IsJumpOffsetArg(opcode)) { fprintf(pyc_output, "%d (to %d)", operand, pos+operand); } else if (Pyc::IsCompareArg(opcode)) { - ssize_t cmp_strings_len = sizeof(cmp_strings) / sizeof(cmp_strings[0]); if (operand < cmp_strings_len) - fprintf(pyc_output, "%d: '%s'", operand, cmp_strings[operand]); + fprintf(pyc_output, "%d (%s)", operand, cmp_strings[operand]); else - fprintf(pyc_output, "%d", operand); + fprintf(pyc_output, "%d (UNKNOWN)", operand); } else { fprintf(pyc_output, "%d", operand); }