comparison python/ppci/c3/codegenerator.py @ 311:ff665880a6b0

Added testcase for kernel and userspace
author Windel Bouwman
date Mon, 16 Dec 2013 12:49:24 +0100
parents 2e7f55319858
children 2c9768114877
comparison
equal deleted inserted replaced
310:e95e5572cd6d 311:ff665880a6b0
178 if not self.equalTypes(expr.a.typ, expr.b.typ): 178 if not self.equalTypes(expr.a.typ, expr.b.typ):
179 raise SemanticError('Types unequal {} != {}' 179 raise SemanticError('Types unequal {} != {}'
180 .format(expr.a.typ, expr.b.typ), expr.loc) 180 .format(expr.a.typ, expr.b.typ), expr.loc)
181 self.emit(ir.CJump(ta, expr.op, tb, bbtrue, bbfalse)) 181 self.emit(ir.CJump(ta, expr.op, tb, bbtrue, bbfalse))
182 else: 182 else:
183 raise NotImplementedError('Unknown condition {}'.format(expr)) 183 raise SemanticError('non-bool: {}'.format(expr.op), expr.loc)
184 expr.typ = self.boolType 184 expr.typ = self.boolType
185 elif type(expr) is ast.Literal: 185 elif type(expr) is ast.Literal:
186 self.genExprCode(expr) 186 self.genExprCode(expr)
187 if expr.val: 187 if expr.val:
188 self.emit(ir.Jump(bbtrue)) 188 self.emit(ir.Jump(bbtrue))