mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 16:22:53 +00:00
Bug 521898, part 3: Rename ProtocolInclude to Include in preparation of more general usage. r=bent
This commit is contained in:
parent
b8b5e55670
commit
5a4d3584f6
@ -12,8 +12,8 @@ class Visitor:
|
||||
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:
|
||||
@ -23,7 +23,7 @@ class Visitor:
|
||||
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
|
||||
@ -153,13 +153,13 @@ class TranslationUnit(Node):
|
||||
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)
|
||||
@ -171,10 +171,10 @@ class CxxInclude(Node):
|
||||
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):
|
||||
|
@ -2359,8 +2359,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
'"'+ _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)
|
||||
@ -2438,8 +2438,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
])
|
||||
|
||||
|
||||
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),
|
||||
|
@ -185,8 +185,8 @@ def p_TranslationUnit(p):
|
||||
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:
|
||||
@ -236,7 +236,7 @@ def p_ProtocolIncludeStmt(p):
|
||||
_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:
|
||||
|
@ -645,7 +645,7 @@ class GatherDecls(TcheckVisitor):
|
||||
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
|
||||
@ -689,14 +689,14 @@ class GatherDecls(TcheckVisitor):
|
||||
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
|
||||
@ -1188,7 +1188,7 @@ class CheckTypes(TcheckVisitor):
|
||||
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)
|
||||
@ -1593,8 +1593,8 @@ class BuildProcessGraph(TcheckVisitor):
|
||||
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
|
||||
@ -1630,8 +1630,8 @@ class BuildProcessGraph(TcheckVisitor):
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user