Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/giscanner/ast.py
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2009-03-19 00:01:58 (GMT)
committer Andreas Rottmann <a.rottmann@gmx.at>2009-03-19 00:01:58 (GMT)
commit23e6fa6993c046de032598127ea48d4a7ee00935 (patch)
tree45cad6ff863aa10091f32c728f73f8b5e9ad87cf /giscanner/ast.py
parent888566c41b4f0d73ec80307d0418ab1d44c7210c (diff)
Bug 556475 – support Shadows: annotation
Add support for the 'Rename To:' annotation for functions and methods.
Diffstat (limited to 'giscanner/ast.py')
-rw-r--r--giscanner/ast.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 0f0d1bb..0d3f0bb 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -158,6 +158,8 @@ class Node(object):
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__, self.name)
+ def remove_matching_children(self, pred):
+ pass
class Namespace(Node):
@@ -170,6 +172,13 @@ class Namespace(Node):
return '%s(%r, %r, %r)' % (self.__class__.__name__, self.name,
self.version, self.nodes)
+ def remove_matching(self, pred):
+
+ def recursive_pred(node):
+ node.remove_matching_children(pred)
+ return pred(node)
+
+ self.nodes = filter(recursive_pred, self.nodes)
class Include(Node):
@@ -384,6 +393,11 @@ class Record(Node):
self.doc = None
self.methods = []
+ def remove_matching_children(self, pred):
+ self.fields = filter(pred, self.fields)
+ self.constructors = filter(pred, self.constructors)
+ self.methods = filter(pred, self.methods)
+
# BW compat, remove
Struct = Record
@@ -433,6 +447,12 @@ class Class(Node):
self.fields = []
self.doc = None
+ def remove_matching_children(self, pred):
+ self.methods = filter(pred, self.methods)
+ self.constructors = filter(pred, self.constructors)
+ self.properties = filter(pred, self.properties)
+ self.fields = filter(pred, self.fields)
+
def __repr__(self):
return '%s(%r, %r, %r)' % (
self.__class__.__name__,