Skip to content
Browse files

Copy the exit block code into every node we generate for it.

  • Loading branch information...
1 parent 92e679a commit 0296389c11675b99bd91eabb1060f81701ecd5ff @nelhage committed Dec 27, 2010
Showing with 10 additions and 4 deletions.
  1. +10 −4 ddx2dot
View
14 ddx2dot
@@ -87,16 +87,21 @@ def gensym():
def findExit(lines):
this_label = None
candidate = False
- return_blocks = set()
+ return_blocks = dict()
+ code = []
for line in lines:
m = re.search(r'^(\w+):', line)
if m:
if candidate:
- return_blocks.add(this_label)
+ return_blocks[this_label] = code
+ code = []
this_label = m.group(1)
candidate = False
+ continue
+ code.append(line)
+
if line.strip().startswith('return'):
candidate = True
else:
@@ -127,9 +132,10 @@ def exitBlock():
def addEdgeTo(to,label='jmp'):
if to in exitBlocks:
- to = gensym()
- node = pydot.Node(to, label='return')
+ tmp = gensym()
+ node = pydot.Node(tmp, label=as_html(exitBlocks[to]))
graph.add_node(node)
+ to = tmp
graph.add_edge(pydot.Edge(block, to, taillabel=label))

0 comments on commit 0296389

Please sign in to comment.
Something went wrong with that request. Please try again.