def arith(self, op): b = self.stack.pop() a = self.stack.pop() if (op != ArithOp.UNM and op != ArithOp.BNOT) else b result = Arithmetic.arith(a, op, b) assert (result is not None) self.stack.push(result)
def arith(self, op): b = self.stack.pop() a = self.stack.pop() if (op != ArithOp.UNM and op != ArithOp.BNOT) else b result = Arithmetic.arith(a, op, b) if result is None: name = Arithmetic.operators[op].metamethod metamethod = self.get_metamethod(a, b, name) result = self.call_metamethod(a, metamethod, b) if metamethod else None if result is None: raise Exception('arith error') self.stack.push(result)
def arith(self, op): b = self.stack.pop() a = self.stack.pop() if (op != ArithOp.UNM and op != ArithOp.BNOT) else b result = Arithmetic.arith(a, op, b) if result is None: name = Arithmetic.operators[op].metamethod metamethod = self.get_metamethod(a, b, name) result = self.call_metamethod(a, metamethod, b) if metamethod else None assert (result is not None) self.stack.push(result)