Fix display of cell vars

This commit is contained in:
Michael Hansen
2016-09-07 18:22:49 -07:00
parent 35e74d0e6e
commit 5ee15c890c
2 changed files with 5 additions and 5 deletions

View File

@@ -358,8 +358,7 @@ void bc_disasm(PycRef<PycCode> code, PycModule* mod, int indent)
} else if (Pyc::IsVarNameArg(opcode)) {
fprintf(pyc_output, "%d: %s", operand, code->getVarName(operand)->value());
} else if (Pyc::IsCellArg(opcode)) {
fprintf(pyc_output, "%d: ", operand);
print_const(code->getCellVar(operand), mod);
fprintf(pyc_output, "%d: %s", operand, code->getCellVar(operand)->value());
} else if (Pyc::IsJumpOffsetArg(opcode)) {
fprintf(pyc_output, "%d (to %d)", operand, pos+operand);
} else if (Pyc::IsCompareArg(opcode)) {

View File

@@ -58,10 +58,11 @@ public:
PycRef<PycString> getVarName(int idx) const
{ return m_varNames->get(idx).cast<PycString>(); }
PycRef<PycObject> getCellVar(int idx) const
PycRef<PycString> getCellVar(int idx) const
{
return (idx >= m_cellVars->size()) ? m_freeVars->get(idx - m_cellVars->size())
: m_cellVars->get(idx);
return (idx >= m_cellVars->size())
? m_freeVars->get(idx - m_cellVars->size()).cast<PycString>()
: m_cellVars->get(idx).cast<PycString>();
}
const globals_t& getGlobals() const { return m_globalsUsed; }