зеркало из https://github.com/mozilla/gecko-dev.git
Bug 521898, part 3: Rename ProtocolInclude to Include in preparation of more general usage. r=bent
This commit is contained in:
Родитель
b8b5e55670
Коммит
5a4d3584f6
|
@ -12,8 +12,8 @@ class Visitor:
|
||||||
def visitTranslationUnit(self, tu):
|
def visitTranslationUnit(self, tu):
|
||||||
for cxxInc in tu.cxxIncludes:
|
for cxxInc in tu.cxxIncludes:
|
||||||
cxxInc.accept(self)
|
cxxInc.accept(self)
|
||||||
for protoInc in tu.protocolIncludes:
|
for inc in tu.includes:
|
||||||
protoInc.accept(self)
|
inc.accept(self)
|
||||||
for su in tu.structsAndUnions:
|
for su in tu.structsAndUnions:
|
||||||
su.accept(self)
|
su.accept(self)
|
||||||
for using in tu.using:
|
for using in tu.using:
|
||||||
|
@ -23,7 +23,7 @@ class Visitor:
|
||||||
def visitCxxInclude(self, inc):
|
def visitCxxInclude(self, inc):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def visitProtocolInclude(self, inc):
|
def visitInclude(self, inc):
|
||||||
# Note: we don't visit the child AST here, because that needs delicate
|
# Note: we don't visit the child AST here, because that needs delicate
|
||||||
# and pass-specific handling
|
# and pass-specific handling
|
||||||
pass
|
pass
|
||||||
|
@ -153,13 +153,13 @@ class TranslationUnit(Node):
|
||||||
Node.__init__(self)
|
Node.__init__(self)
|
||||||
self.filename = None
|
self.filename = None
|
||||||
self.cxxIncludes = [ ]
|
self.cxxIncludes = [ ]
|
||||||
self.protocolIncludes = [ ]
|
self.includes = [ ]
|
||||||
self.using = [ ]
|
self.using = [ ]
|
||||||
self.structsAndUnions = [ ]
|
self.structsAndUnions = [ ]
|
||||||
self.protocol = None
|
self.protocol = None
|
||||||
|
|
||||||
def addCxxInclude(self, cxxInclude): self.cxxIncludes.append(cxxInclude)
|
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 addStructDecl(self, struct): self.structsAndUnions.append(struct)
|
||||||
def addUnionDecl(self, union): self.structsAndUnions.append(union)
|
def addUnionDecl(self, union): self.structsAndUnions.append(union)
|
||||||
def addUsingStmt(self, using): self.using.append(using)
|
def addUsingStmt(self, using): self.using.append(using)
|
||||||
|
@ -171,10 +171,10 @@ class CxxInclude(Node):
|
||||||
Node.__init__(self, loc)
|
Node.__init__(self, loc)
|
||||||
self.file = cxxFile
|
self.file = cxxFile
|
||||||
|
|
||||||
class ProtocolInclude(Node):
|
class Include(Node):
|
||||||
def __init__(self, loc, protocolName):
|
def __init__(self, loc, name):
|
||||||
Node.__init__(self, loc)
|
Node.__init__(self, loc)
|
||||||
self.file = "%s.ipdl" % protocolName
|
self.file = "%s.ipdl" % name
|
||||||
|
|
||||||
class UsingStmt(Node):
|
class UsingStmt(Node):
|
||||||
def __init__(self, loc, cxxTypeSpec):
|
def __init__(self, loc, cxxTypeSpec):
|
||||||
|
|
|
@ -2359,8 +2359,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||||
'"'+ _protocolHeaderName(tu.protocol) +'.h"')
|
'"'+ _protocolHeaderName(tu.protocol) +'.h"')
|
||||||
])
|
])
|
||||||
|
|
||||||
for pinc in tu.protocolIncludes:
|
for inc in tu.includes:
|
||||||
pinc.accept(self)
|
inc.accept(self)
|
||||||
|
|
||||||
# this generates the actor's full impl in self.cls
|
# this generates the actor's full impl in self.cls
|
||||||
tu.protocol.accept(self)
|
tu.protocol.accept(self)
|
||||||
|
@ -2438,8 +2438,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def visitProtocolInclude(self, pi):
|
def visitInclude(self, inc):
|
||||||
ip = pi.tu.protocol
|
ip = inc.tu.protocol
|
||||||
|
|
||||||
self.hdrfile.addthings([
|
self.hdrfile.addthings([
|
||||||
_makeForwardDeclForActor(ip.decl.type, self.side),
|
_makeForwardDeclForActor(ip.decl.type, self.side),
|
||||||
|
|
|
@ -185,8 +185,8 @@ def p_TranslationUnit(p):
|
||||||
for stmt in p[1]:
|
for stmt in p[1]:
|
||||||
if isinstance(stmt, CxxInclude):
|
if isinstance(stmt, CxxInclude):
|
||||||
tu.addCxxInclude(stmt)
|
tu.addCxxInclude(stmt)
|
||||||
elif isinstance(stmt, ProtocolInclude):
|
elif isinstance(stmt, Include):
|
||||||
tu.addProtocolInclude(stmt)
|
tu.addInclude(stmt)
|
||||||
elif isinstance(stmt, UsingStmt):
|
elif isinstance(stmt, UsingStmt):
|
||||||
tu.addUsingStmt(stmt)
|
tu.addUsingStmt(stmt)
|
||||||
else:
|
else:
|
||||||
|
@ -236,7 +236,7 @@ def p_ProtocolIncludeStmt(p):
|
||||||
_error(loc, "`include protocol \"P.ipdl\"' syntax is obsolete. Use `include protocol P' instead.")
|
_error(loc, "`include protocol \"P.ipdl\"' syntax is obsolete. Use `include protocol P' instead.")
|
||||||
|
|
||||||
Parser.current.loc = loc
|
Parser.current.loc = loc
|
||||||
inc = ProtocolInclude(loc, p[3])
|
inc = Include(loc, p[3])
|
||||||
|
|
||||||
path = Parser.current.resolveIncludePath(inc.file)
|
path = Parser.current.resolveIncludePath(inc.file)
|
||||||
if path is None:
|
if path is None:
|
||||||
|
|
|
@ -645,7 +645,7 @@ class GatherDecls(TcheckVisitor):
|
||||||
p.decl.type._ast = p
|
p.decl.type._ast = p
|
||||||
|
|
||||||
# make sure we have decls for all dependent protocols
|
# make sure we have decls for all dependent protocols
|
||||||
for pinc in tu.protocolIncludes:
|
for pinc in tu.includes:
|
||||||
pinc.accept(self)
|
pinc.accept(self)
|
||||||
|
|
||||||
# declare imported (and builtin) C++ types
|
# declare imported (and builtin) C++ types
|
||||||
|
@ -689,14 +689,14 @@ class GatherDecls(TcheckVisitor):
|
||||||
self.symtab = savedSymtab
|
self.symtab = savedSymtab
|
||||||
|
|
||||||
|
|
||||||
def visitProtocolInclude(self, pi):
|
def visitInclude(self, inc):
|
||||||
if pi.tu is None:
|
if inc.tu is None:
|
||||||
self.error(
|
self.error(
|
||||||
pi.loc,
|
inc.loc,
|
||||||
"(type checking here will be unreliable because of an earlier error)")
|
"(type checking here will be unreliable because of an earlier error)")
|
||||||
return
|
return
|
||||||
pi.tu.accept(self)
|
inc.tu.accept(self)
|
||||||
self.symtab.declare(pi.tu.protocol.decl)
|
self.symtab.declare(inc.tu.protocol.decl)
|
||||||
|
|
||||||
def visitStructDecl(self, sd):
|
def visitStructDecl(self, sd):
|
||||||
stype = sd.decl.type
|
stype = sd.decl.type
|
||||||
|
@ -1188,7 +1188,7 @@ class CheckTypes(TcheckVisitor):
|
||||||
self.visited = set()
|
self.visited = set()
|
||||||
self.ptype = None
|
self.ptype = None
|
||||||
|
|
||||||
def visitProtocolInclude(self, inc):
|
def visitInclude(self, inc):
|
||||||
if inc.tu.filename in self.visited:
|
if inc.tu.filename in self.visited:
|
||||||
return
|
return
|
||||||
self.visited.add(inc.tu.filename)
|
self.visited.add(inc.tu.filename)
|
||||||
|
@ -1593,8 +1593,8 @@ class BuildProcessGraph(TcheckVisitor):
|
||||||
def visitTranslationUnit(self, tu):
|
def visitTranslationUnit(self, tu):
|
||||||
TcheckVisitor.visitTranslationUnit(self, tu)
|
TcheckVisitor.visitTranslationUnit(self, tu)
|
||||||
|
|
||||||
def visitProtocolInclude(self, pi):
|
def visitInclude(self, inc):
|
||||||
pi.tu.protocol.accept(self)
|
inc.tu.protocol.accept(self)
|
||||||
|
|
||||||
def visitProtocol(self, p):
|
def visitProtocol(self, p):
|
||||||
ptype = p.decl.type
|
ptype = p.decl.type
|
||||||
|
@ -1630,8 +1630,8 @@ class BuildProcessGraph(TcheckVisitor):
|
||||||
tu.accept(self.findSpawns(self.errors))
|
tu.accept(self.findSpawns(self.errors))
|
||||||
TcheckVisitor.visitTranslationUnit(self, tu)
|
TcheckVisitor.visitTranslationUnit(self, tu)
|
||||||
|
|
||||||
def visitProtocolInclude(self, pi):
|
def visitInclude(self, inc):
|
||||||
pi.tu.protocol.accept(self)
|
inc.tu.protocol.accept(self)
|
||||||
|
|
||||||
def visitProtocol(self, p):
|
def visitProtocol(self, p):
|
||||||
ptype = p.decl.type
|
ptype = p.decl.type
|
||||||
|
|
Загрузка…
Ссылка в новой задаче