compiler: change codegen to emit NUMEQUAL instead of EQUAL

This is wrong, see issue #294, but it makes our VM tests work (as VM is
missing EQUAL implementation), so until #294 is properly resolved we're better
have this kind of wrong code generation.
This commit is contained in:
Roman Khimov 2019-08-15 18:22:56 +03:00
parent 01330e7ed7
commit 810f096811

View file

@ -705,11 +705,10 @@ func (c *codegen) convertToken(tok token.Token) {
case token.GEQ: case token.GEQ:
emitOpcode(c.prog, vm.GTE) emitOpcode(c.prog, vm.GTE)
case token.EQL: case token.EQL:
// It seems that (looking to the python compiler) that comparing for // TODO: this is wrong (and the next one also is), see issue #294
// equal (==) needs to return the instruction EQUAL. Where comparing // Changing it EQUAL is not that big of an improvement, so we're
// (anything) to not equal (!=) needs to use the opcode NUMNOTEQUAL // using NUMEQUAL for now
// even for comparing strings. emitOpcode(c.prog, vm.NUMEQUAL)
emitOpcode(c.prog, vm.EQUAL)
case token.NEQ: case token.NEQ:
emitOpcode(c.prog, vm.NUMNOTEQUAL) emitOpcode(c.prog, vm.NUMNOTEQUAL)
case token.DEC: case token.DEC: