diff python/ppci/c3/analyse.py @ 301:6753763d3bec

merge codegen into ppci package
author Windel Bouwman
date Thu, 05 Dec 2013 17:02:38 +0100
parents 158068af716c
children 0615b5308710
line wrap: on
line diff
--- a/python/ppci/c3/analyse.py	Tue Dec 03 18:00:22 2013 +0100
+++ b/python/ppci/c3/analyse.py	Thu Dec 05 17:02:38 2013 +0100
@@ -80,12 +80,14 @@
                 continue
             ip = packageDict[i]
             pkg.scope.addSymbol(ip)
-        FixRefs(self.diag).fixRefs(pkg)
-        return self.ok
+        fr = FixRefs(self.diag)
+        fr.fixRefs(pkg)
+        return self.ok and fr.ok
 
 
 class FixRefs(C3Pass):
     def fixRefs(self, pkg):
+        self.ok = True
         self.logger.info('Resolving references for {}'.format(pkg.name))
         self.visitor.visit(pkg, self.findRefs)
 
@@ -236,11 +238,8 @@
             sym.typ = sym.proc.typ.returntype
         elif type(sym) is VariableUse:
             sym.lvalue = True
-            if isinstance(sym.target, Variable):
-                sym.typ = sym.target.typ
-            else:
-                print('warning {} has no target, defaulting to int'.format(sym))
-                sym.typ = intType
+            assert isinstance(sym.target, Variable), sym.target
+            sym.typ = sym.target.typ
         elif type(sym) is Literal:
             sym.lvalue = False
             if type(sym.val) is int: