1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 41 unchanged lines hidden (view full) --- 50 self.cond.error("Condition of if stmt must be bool, type was '%s'", 51 ctype) 52 53 # Conditional 54 code.indent() 55 code('if ($cond_code) {') 56 # Then part 57 code.indent() |
58 self.symtab.pushFrame() |
59 self.then.generate(code, return_type) |
60 self.symtab.popFrame() |
61 code.dedent() 62 # Else part 63 if self.else_: 64 code('} else {') 65 code.indent() |
66 self.symtab.pushFrame() |
67 self.else_.generate(code, return_type) |
68 self.symtab.popFrame() |
69 code.dedent() 70 code('}') # End scope 71 72 def findResources(self, resources): 73 # Take a worse case look at both paths 74 self.then.findResources(resources) 75 if self.else_ is not None: 76 self.else_.findResources(resources) |