diff python/c3/builder.py @ 289:bd2593de3ff8

Semifix burn2
author Windel Bouwman
date Thu, 21 Nov 2013 15:46:50 +0100
parents a747a45dcd78
children 6aa721e7b10b
line wrap: on
line diff
--- a/python/c3/builder.py	Thu Nov 21 14:26:13 2013 +0100
+++ b/python/c3/builder.py	Thu Nov 21 15:46:50 2013 +0100
@@ -1,6 +1,7 @@
 import logging
 import ppci
 from . import Parser, TypeChecker, Analyzer, CodeGenerator
+from .analyse import AddScope
 
 
 class Builder:
@@ -36,11 +37,16 @@
                     continue
                 # Store for later use:
                 packages[pkg.name] = pkg
+        # Fix scopes:
         for pkg in packages.values():
-            # TODO: merge the two below?
+            if not AddScope(self.diag).addScope(pkg):
+                self.ok = False
+        # TODO: fix error handling better
+        for pkg in packages.values():
             if not self.al.analyzePackage(pkg, packages):
                 self.ok = False
                 continue
+        for pkg in packages.values():
             if not self.tc.checkPackage(pkg):
                 self.ok = False
                 continue