From 20416d5ae946d4defbfea66c53e58761cf885b73 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 1 Dec 2011 18:28:36 +0000 Subject: WIP for func parameter support and local (automatic) variables --- LinkedNode.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'LinkedNode.py') diff --git a/LinkedNode.py b/LinkedNode.py index 864f708..88bc6da 100644 --- a/LinkedNode.py +++ b/LinkedNode.py @@ -59,7 +59,12 @@ class LinkedNode(object): # the node appears to have an own variable scope if defined_names is None: raise RuntimeError("No object found for storing variables") - self.variables = Variables(defined_names, parent_variables) + # pass function object for local variables allocation + function = self.getFunctionNode() + if function: + function = function.function + self.variables = Variables(parent_variables, defined_names, + function=function) # Identifiers which are in use (think of variables and labels) self.defined_names = defined_names if not self.variables: @@ -93,7 +98,7 @@ class LinkedNode(object): "Enum", # enum type "Enumerator", # enum value "EnumeratorList", # list of enum values - "FuncDecl", "Goto", "Label", "ParamList", "PtrDecl", "Struct", + "Goto", "Label", "ParamList", "PtrDecl", "Struct", "TypeDecl", "Typedef", "Union") def getStatementNode(self): """Returns the nearest LinkedNode which is a statement node type""" -- cgit v1.2.1