Mercurial > lcfOS
diff python/c3/codegenerator.py @ 288:a747a45dcd78
Various styling work
author | Windel Bouwman |
---|---|
date | Thu, 21 Nov 2013 14:26:13 +0100 |
parents | 1c7c1e619be8 |
children |
line wrap: on
line diff
--- a/python/c3/codegenerator.py Thu Nov 21 11:57:27 2013 +0100 +++ b/python/c3/codegenerator.py Thu Nov 21 14:26:13 2013 +0100 @@ -7,7 +7,7 @@ class CodeGenerator(ir.Builder): - """ + """ Generates intermediate (IR) code from a package. The entry function is 'genModule'. The main task of this part is to rewrite complex control structures, such as while and for loops into simple conditional @@ -22,7 +22,7 @@ self.prepare() assert type(pkg) is astnodes.Package self.logger.info('Generating ir-code for {}'.format(pkg.name)) - self.varMap = {} # Maps variables to storage locations. + self.varMap = {} # Maps variables to storage locations. self.funcMap = {} self.m = ir.Module(pkg.name) self.genModule(pkg) @@ -140,12 +140,12 @@ else: raise NotImplementedError('Unknown condition {}'.format(expr)) elif type(expr) is astnodes.Literal: - if expr.val: + if expr.val: self.emit(ir.Jump(bbtrue)) - else: + else: self.emit(ir.Jump(bbfalse)) else: - raise NotImplementedError('Unknown cond {}'.format(expr)) + raise NotImplementedError('Unknown cond {}'.format(expr)) def genExprCode(self, expr): assert isinstance(expr, astnodes.Expression) @@ -196,4 +196,3 @@ return ir.Call(fn, args) else: raise NotImplementedError('Unknown expr {}'.format(expr)) -