Skip to content
Snippets Groups Projects

implemented reachability checking. passing 56 test cases locally

Merged Pui Yan Chloe Sham requested to merge reachabilityCheck into master
6 files
+ 123
81
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 2
20
@@ -68,28 +68,10 @@ class ASTNode():
if c and hasattr(c, 'checkType'):
c.checkType()
def staticAnalysis(self):
for c in self.children:
if c and hasattr(c, 'staticAnalysis'):
c.staticAnalysis()
# return outMaybe
def reachCheck(self, inMaybe = True):
if inMaybe == False:
# error if in[s] = no for any s
# I don't think it should get to here... but maybe?
raise Exception("in[s] = no for a certain {}".format(type(self)))
self.inMaybe = inMaybe
self.outMaybe = self.inMaybe
lastOut = self.inMaybe
def reachCheck(self, inMaybe=True):
for c in self.children:
if c and hasattr(c, 'reachCheck'):
lastOut = c.reachCheck(lastOut)
self.outMaybe = self.outMaybe and lastOut
return self.outMaybe
c.reachCheck(inMaybe)
def printNodePretty(self, prefix=0):
pp = pprint.PrettyPrinter(indent=prefix)
Loading