comparison python/ppci/c3/builder.py @ 366:39bf68bf1891

Fix sample tests and deterministic build
author Windel Bouwman
date Fri, 21 Mar 2014 09:43:01 +0100
parents 5477e499b039
children fb3c1f029b30
comparison
equal deleted inserted replaced
365:98ff43cfdd36 366:39bf68bf1891
103 103
104 # Parsing stage (phase 1) 104 # Parsing stage (phase 1)
105 def doParse(src): 105 def doParse(src):
106 tokens = self.lexer.lex(src) 106 tokens = self.lexer.lex(src)
107 return self.parser.parseSource(tokens) 107 return self.parser.parseSource(tokens)
108 s_pkgs = set(map(doParse, srcs)) 108 s_pkgs = list(map(doParse, srcs))
109 i_pkgs = set(map(doParse, imps)) 109 i_pkgs = list(map(doParse, imps))
110 all_pkgs = s_pkgs | i_pkgs 110 all_pkgs = s_pkgs + i_pkgs
111 if not all(all_pkgs): 111 if not all(all_pkgs):
112 self.ok = False 112 self.ok = False
113 return 113 return
114 114
115 # Fix scopes and package refs (phase 1.5) 115 # Fix scopes and package refs (phase 1.5)
124 self.ok = False 124 self.ok = False
125 return 125 return
126 126
127 # Generate intermediate code (phase 2) 127 # Generate intermediate code (phase 2)
128 # Only return ircode when everything is OK 128 # Only return ircode when everything is OK
129 for pkg in all_pkgs & s_pkgs: 129 for pkg in s_pkgs:
130 yield self.cg.gencode(pkg) 130 yield self.cg.gencode(pkg)
131 if not all(pkg.ok for pkg in all_pkgs): 131 if not all(pkg.ok for pkg in all_pkgs):
132 self.ok = False 132 self.ok = False