From 4ac454608da0616f4727c10e19161e47570b54db Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 30 Nov 2011 20:29:21 +0000 Subject: Set correct label in ASM --- pp2cc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pp2cc.py') diff --git a/pp2cc.py b/pp2cc.py index 78ce05d..11ff592 100755 --- a/pp2cc.py +++ b/pp2cc.py @@ -378,7 +378,9 @@ class LinkedNode(object): return self.parent.getContinueNode() return None def setLabel(self, label_name): - """Sets the label for this node""" + """Sets the label for this node and return the label name as it appears + in assembly + """ if self.parent: function = self.parent.getFunctionNode() if not self.parent or not function: @@ -393,6 +395,7 @@ class LinkedNode(object): i += 1 function.goto_labels[label_name] = label_asm + return label_asm def lookupLabel(self, label_name): """Returns the label name as it appears in assembly for label_name""" # get the nearest function for this node @@ -1334,8 +1337,7 @@ class Parse(object): return lines def parseLabel(self, linked_node): lines = [] - label_name = linked_node.node.name - linked_node.setLabel(label_name) + label_name = linked_node.setLabel(linked_node.node.name) lines.append(self.asm.noop(label_name)) lines += self.parseStatement(linked_node.node.stmt, linked_node) return lines -- cgit v1.2.1