Pepper: Simplify IDLVisitor.
This change cleans up some unnecessary code in IDLVisitor and
IDLLabelResolver. I was poking around in here as part of supporting
"dev channel" API versions, and figured it's worth cleaning up.
For testing, I ran idl_tests.py, and confirmed that generator.py gave
the same output as before.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/91763003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237609 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/generators/idl_visitor.py b/ppapi/generators/idl_visitor.py
index 1ea1c9c..7945f61 100644
--- a/ppapi/generators/idl_visitor.py
+++ b/ppapi/generators/idl_visitor.py
@@ -19,30 +19,22 @@
class IDLVisitor(object):
def __init__(self):
- self.depth = 0
+ pass
# Return TRUE if the node should be visited
def VisitFilter(self, node, data):
return True
- # Return TRUE if data should be added to the childdata list
- def AgrigateFilter(self, data):
- return data is not None
-
def Visit(self, node, data):
- self.depth += 1
if not self.VisitFilter(node, data): return None
childdata = []
newdata = self.Arrive(node, data)
for child in node.GetChildren():
ret = self.Visit(child, newdata)
- if self.AgrigateFilter(ret):
+ if ret is not None:
childdata.append(ret)
- out = self.Depart(node, newdata, childdata)
-
- self.depth -= 1
- return out
+ return self.Depart(node, newdata, childdata)
def Arrive(self, node, data):
__pychecker__ = 'unusednames=node'
@@ -51,31 +43,3 @@
def Depart(self, node, data, childdata):
__pychecker__ = 'unusednames=node,childdata'
return data
-
-
-#
-# IDLVersionVisitor
-#
-# The IDLVersionVisitor will only visit nodes with intervals that include the
-# version. It will also optionally filter based on a class list
-#
-class IDLVersionVisitor(object):
- def __init__(self, version, classList):
- self.version = version
- self.classes = classes
-
- def Filter(self, node, data):
- if self.classList and node.cls not in self.classList: return False
- if not node.IsVersion(self.version): return False
- return True
-
-class IDLRangeVisitor(object):
- def __init__(self, vmin, vmax, classList):
- self.vmin = vmin
- self.vmax = vmax
- self.classList = classList
-
- def Filter(self, node, data):
- if self.classList and node.cls not in self.classList: return False
- if not node.IsVersion(self.version): return False
- return True