Bug 521898, part 3: Rename ProtocolInclude to Include in preparation of more general usage. r=bent
authorChris Jones <jones.chris.g@gmail.com>
Fri, 08 Jun 2012 17:25:36 -0700
changeset 101025 b96cb0e882eb5c2f2e59f6c405f537a09ce5dd06
parent 101024 038ac44e564b1458ca8ea5cc19399532333ea1aa
child 101026 f713eb64e8e1370a38c12a9bd4a73f269cc3a6a2
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs521898
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 521898, part 3: Rename ProtocolInclude to Include in preparation of more general usage. r=bent
ipc/ipdl/ipdl/ast.py
ipc/ipdl/ipdl/lower.py
ipc/ipdl/ipdl/parser.py
ipc/ipdl/ipdl/type.py
--- a/ipc/ipdl/ipdl/ast.py
+++ b/ipc/ipdl/ipdl/ast.py
@@ -7,28 +7,28 @@ import sys
 class Visitor:
     def defaultVisit(self, node):
         raise Exception, "INTERNAL ERROR: no visitor for node type `%s'"% (
             node.__class__.__name__)
 
     def visitTranslationUnit(self, tu):
         for cxxInc in tu.cxxIncludes:
             cxxInc.accept(self)
-        for protoInc in tu.protocolIncludes:
-            protoInc.accept(self)
+        for inc in tu.includes:
+            inc.accept(self)
         for su in tu.structsAndUnions:
             su.accept(self)
         for using in tu.using:
             using.accept(self)
         tu.protocol.accept(self)
 
     def visitCxxInclude(self, inc):
         pass
 
-    def visitProtocolInclude(self, inc):
+    def visitInclude(self, inc):
         # Note: we don't visit the child AST here, because that needs delicate
         # and pass-specific handling
         pass
 
     def visitStructDecl(self, struct):
         for f in struct.fields:
             f.accept(self)
 
@@ -148,38 +148,38 @@ class NamespacedNode(Node):
         return QualifiedId(self.loc, self.name,
                            [ ns.name for ns in self.namespaces ])
 
 class TranslationUnit(Node):
     def __init__(self):
         Node.__init__(self)
         self.filename = None
         self.cxxIncludes = [ ]
-        self.protocolIncludes = [ ]
+        self.includes = [ ]
         self.using = [ ]
         self.structsAndUnions = [ ]
         self.protocol = None
 
     def addCxxInclude(self, cxxInclude): self.cxxIncludes.append(cxxInclude)
-    def addProtocolInclude(self, pInc): self.protocolIncludes.append(pInc)
+    def addInclude(self, inc): self.includes.append(inc)
     def addStructDecl(self, struct): self.structsAndUnions.append(struct)
     def addUnionDecl(self, union): self.structsAndUnions.append(union)
     def addUsingStmt(self, using): self.using.append(using)
 
     def setProtocol(self, protocol): self.protocol = protocol
 
 class CxxInclude(Node):
     def __init__(self, loc, cxxFile):
         Node.__init__(self, loc)
         self.file = cxxFile
 
-class ProtocolInclude(Node):
-    def __init__(self, loc, protocolName):
+class Include(Node):
+    def __init__(self, loc, name):
         Node.__init__(self, loc)
-        self.file = "%s.ipdl" % protocolName
+        self.file = "%s.ipdl" % name
 
 class UsingStmt(Node):
     def __init__(self, loc, cxxTypeSpec):
         Node.__init__(self, loc)
         self.type = cxxTypeSpec
 
 # "singletons"
 class ASYNC:
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -2354,18 +2354,18 @@ class _GenerateProtocolActorCode(ipdl.as
             + _includeGuardStart(hf)
             +[
                 Whitespace.NL,
                 CppDirective(
                     'include',
                     '"'+ _protocolHeaderName(tu.protocol) +'.h"')
             ])
 
-        for pinc in tu.protocolIncludes:
-            pinc.accept(self)
+        for inc in tu.includes:
+            inc.accept(self)
 
         # this generates the actor's full impl in self.cls
         tu.protocol.accept(self)
 
         clsdecl, clsdefn = _splitClassDeclDefn(self.cls)
 
         # XXX damn C++ ... return types in the method defn aren't in
         # class scope
@@ -2433,18 +2433,18 @@ class _GenerateProtocolActorCode(ipdl.as
             Whitespace.NL,
             Whitespace.NL,
             clsdefn,
             Whitespace.NL,
             Whitespace.NL
         ])
 
 
-    def visitProtocolInclude(self, pi):
-        ip = pi.tu.protocol
+    def visitInclude(self, inc):
+        ip = inc.tu.protocol
 
         self.hdrfile.addthings([
             _makeForwardDeclForActor(ip.decl.type, self.side),
             Whitespace.NL
         ])
         self.protocolCxxIncludes.append(
             CppDirective(
                 'include',
--- a/ipc/ipdl/ipdl/parser.py
+++ b/ipc/ipdl/ipdl/parser.py
@@ -180,18 +180,18 @@ def t_error(t):
 ##-----------------------------------------------------------------------------
 
 def p_TranslationUnit(p):
     """TranslationUnit : Preamble NamespacedStuff"""
     tu = Parser.current.tu
     for stmt in p[1]:
         if isinstance(stmt, CxxInclude):
             tu.addCxxInclude(stmt)
-        elif isinstance(stmt, ProtocolInclude):
-            tu.addProtocolInclude(stmt)
+        elif isinstance(stmt, Include):
+            tu.addInclude(stmt)
         elif isinstance(stmt, UsingStmt):
             tu.addUsingStmt(stmt)
         else:
             assert 0
 
     for thing in p[2]:
         if isinstance(thing, StructDecl):
             tu.addStructDecl(thing)
@@ -231,17 +231,17 @@ def p_ProtocolIncludeStmt(p):
     """ProtocolIncludeStmt : INCLUDE PROTOCOL ID
                            | INCLUDE PROTOCOL STRING"""
     loc = locFromTok(p, 1)
     
     if 0 <= p[3].rfind('.ipdl'):
         _error(loc, "`include protocol \"P.ipdl\"' syntax is obsolete.  Use `include protocol P' instead.")
     
     Parser.current.loc = loc
-    inc = ProtocolInclude(loc, p[3])
+    inc = Include(loc, p[3])
 
     path = Parser.current.resolveIncludePath(inc.file)
     if path is None:
         raise ParseError(loc, "can't locate protocol include file `%s'"% (
                 inc.file))
     
     inc.tu = Parser().parse(open(path).read(), path, Parser.current.includedirs, Parser.current.errout)
     p[0] = inc
--- a/ipc/ipdl/ipdl/type.py
+++ b/ipc/ipdl/ipdl/type.py
@@ -640,17 +640,17 @@ class GatherDecls(TcheckVisitor):
             shortname=p.name,
             fullname=fullname)
 
         # XXX ugh, this sucks.  but we need this information to compute
         # what friend decls we need in generated C++
         p.decl.type._ast = p
 
         # make sure we have decls for all dependent protocols
-        for pinc in tu.protocolIncludes:
+        for pinc in tu.includes:
             pinc.accept(self)
 
         # declare imported (and builtin) C++ types
         for using in tu.using:
             using.accept(self)
 
         # first pass to "forward-declare" all structs and unions in
         # order to support recursive definitions
@@ -684,24 +684,24 @@ class GatherDecls(TcheckVisitor):
         # grab symbols in the protocol itself
         p.accept(self)
 
         tu.type = VOID
 
         self.symtab = savedSymtab
 
 
-    def visitProtocolInclude(self, pi):
-        if pi.tu is None:
+    def visitInclude(self, inc):
+        if inc.tu is None:
             self.error(
-                pi.loc,
+                inc.loc,
                 "(type checking here will be unreliable because of an earlier error)")
             return
-        pi.tu.accept(self)
-        self.symtab.declare(pi.tu.protocol.decl)
+        inc.tu.accept(self)
+        self.symtab.declare(inc.tu.protocol.decl)
 
     def visitStructDecl(self, sd):
         stype = sd.decl.type
 
         self.symtab.enterScope(sd)
 
         for f in sd.fields:
             ftypedecl = self.symtab.lookup(str(f.typespec))
@@ -1183,17 +1183,17 @@ def fullyDefined(t, exploring=None):
 
 class CheckTypes(TcheckVisitor):
     def __init__(self, errors):
         # don't need the symbol table, we just want the error reporting
         TcheckVisitor.__init__(self, None, errors)
         self.visited = set()
         self.ptype = None
 
-    def visitProtocolInclude(self, inc):
+    def visitInclude(self, inc):
         if inc.tu.filename in self.visited:
             return
         self.visited.add(inc.tu.filename)
         inc.tu.protocol.accept(self)
 
 
     def visitStructDecl(self, sd):
         if not fullyDefined(sd.decl.type):
@@ -1588,18 +1588,18 @@ class ProcessGraph:
 class BuildProcessGraph(TcheckVisitor):
     class findSpawns(TcheckVisitor):
         def __init__(self, errors):
             TcheckVisitor.__init__(self, None, errors)
 
         def visitTranslationUnit(self, tu):
             TcheckVisitor.visitTranslationUnit(self, tu)
 
-        def visitProtocolInclude(self, pi):
-            pi.tu.protocol.accept(self)
+        def visitInclude(self, inc):
+            inc.tu.protocol.accept(self)
 
         def visitProtocol(self, p):
             ptype = p.decl.type
             # non-top-level protocols don't add any information
             if not ptype.isToplevel() or ptype in ProcessGraph.visitedSpawns:
                 return
 
             ProcessGraph.visitedSpawns.add(ptype)
@@ -1625,18 +1625,18 @@ class BuildProcessGraph(TcheckVisitor):
         TcheckVisitor.__init__(self, None, errors)
         self.visiting = None            # ActorType
         self.visited = set()            # set(ActorType)
 
     def visitTranslationUnit(self, tu):
         tu.accept(self.findSpawns(self.errors))
         TcheckVisitor.visitTranslationUnit(self, tu)
 
-    def visitProtocolInclude(self, pi):
-        pi.tu.protocol.accept(self)
+    def visitInclude(self, inc):
+        inc.tu.protocol.accept(self)
 
     def visitProtocol(self, p):
         ptype = p.decl.type
         # non-top-level protocols don't add any information
         if not ptype.isToplevel() or ptype in ProcessGraph.visitedBridges:
             return
 
         ProcessGraph.visitedBridges.add(ptype)