This patch walks up the parse tree from a Variable to find the containing
module, rather than assuming all Variables are two levels below the module,
which breaks for module-level variables.
diff -r c5b88e996b11 -r 732d6b540026 fparser/base_classes.py
--- a/fparser/base_classes.py Fri Jan 27 14:26:10 2012 +0000
+++ b/fparser/base_classes.py Fri Jan 27 14:29:58 2012 +0000
@@ -282,7 +282,11 @@
def is_private(self):
if 'PUBLIC' in self.attributes: return False
if 'PRIVATE' in self.attributes: return True
- return self.parent.parent.check_private(self.name)
+
+ mod = self.parent
+ while not hasattr(mod, 'check_private'):
+ mod = mod.parent
+ return mod.check_private(self.name)
def is_public(self): return not self.is_private()
def is_allocatable(self): return 'ALLOCATABLE' in self.attributes
Original issue reported on code.google.com by james.ke...@gmail.com on 27 Jan 2012 at 2:43
Original issue reported on code.google.com by
james.ke...@gmail.com
on 27 Jan 2012 at 2:43