Bug 1024795, part 1 - Remove trailing whitespace from lower.py. r=bent

This commit is contained in:
Andrew McCreight 2014-08-13 11:36:14 -07:00
parent 64aad00143
commit d7d7c1de23

View File

@ -795,7 +795,7 @@ IPDL union type."""
def callCtor(self, expr=None): def callCtor(self, expr=None):
assert not isinstance(expr, list) assert not isinstance(expr, list)
if expr is None: if expr is None:
args = None args = None
elif self.ipdltype.isIPDL() and self.ipdltype.isActor(): elif self.ipdltype.isIPDL() and self.ipdltype.isActor():
@ -868,7 +868,7 @@ IPDL union type."""
class MessageDecl(ipdl.ast.MessageDecl): class MessageDecl(ipdl.ast.MessageDecl):
def baseName(self): def baseName(self):
return self.name return self.name
def recvMethod(self): def recvMethod(self):
name = _recvPrefix(self.decl.type) + self.baseName() name = _recvPrefix(self.decl.type) + self.baseName()
if self.decl.type.isCtor(): if self.decl.type.isCtor():
@ -1091,7 +1091,7 @@ class Protocol(ipdl.ast.Protocol):
def adoptSharedMemory(self): def adoptSharedMemory(self):
return ExprVar('AdoptSharedMemory') return ExprVar('AdoptSharedMemory')
def lookupSharedMemory(self): def lookupSharedMemory(self):
return ExprVar('LookupSharedMemory') return ExprVar('LookupSharedMemory')
@ -1462,7 +1462,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
for headername in sorted(iter(aggregateTypeIncludes)): for headername in sorted(iter(aggregateTypeIncludes)):
hf.addthing(CppDirective('include', '"' + headername + '"')) hf.addthing(CppDirective('include', '"' + headername + '"'))
ipdl.ast.Visitor.visitTranslationUnit(self, tu) ipdl.ast.Visitor.visitTranslationUnit(self, tu)
if tu.filetype == 'header': if tu.filetype == 'header':
self.cppIncludeHeaders.append(_ipdlhHeaderName(tu)) self.cppIncludeHeaders.append(_ipdlhHeaderName(tu))
@ -1478,7 +1478,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
+ [ Whitespace.NL ] + [ Whitespace.NL ]
)) ))
if self.protocol: if self.protocol:
# construct the namespace into which we'll stick all our defns # construct the namespace into which we'll stick all our defns
ns = Namespace(self.protocol.name) ns = Namespace(self.protocol.name)
cf.addthing(_putInNamespaces(ns, self.protocol.namespaces)) cf.addthing(_putInNamespaces(ns, self.protocol.namespaces))
@ -1499,7 +1499,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
def processStructOrUnionClass(self, su, which, forwarddecls, cls): def processStructOrUnionClass(self, su, which, forwarddecls, cls):
clsdecl, methoddefns = _splitClassDeclDefn(cls) clsdecl, methoddefns = _splitClassDeclDefn(cls)
self.hdrfile.addthings( self.hdrfile.addthings(
[ Whitespace.NL ] [ Whitespace.NL ]
+ forwarddecls + forwarddecls
@ -1681,7 +1681,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
ptype = self.protocol.decl.type ptype = self.protocol.decl.type
usesend, sendvar = set(), ExprVar('__Send') usesend, sendvar = set(), ExprVar('__Send')
userecv, recvvar = set(), ExprVar('__Recv') userecv, recvvar = set(), ExprVar('__Recv')
def sameTrigger(trigger, actionexpr): def sameTrigger(trigger, actionexpr):
if trigger is ipdl.ast.SEND or trigger is ipdl.ast.CALL: if trigger is ipdl.ast.SEND or trigger is ipdl.ast.CALL:
usesend.add('yes') usesend.add('yes')
@ -1846,7 +1846,7 @@ def _generateMessageClass(clsname, msgid, prettyName, compress):
Decl(Type('base::ProcessHandle'), otherprocess.name), Decl(Type('base::ProcessHandle'), otherprocess.name),
Decl(Type('bool'), receiving.name) ]), Decl(Type('bool'), receiving.name) ]),
const=1)) const=1))
# TODO/cjones: allow selecting what information is printed to # TODO/cjones: allow selecting what information is printed to
# the log # the log
msgvar = ExprVar('__logmsg') msgvar = ExprVar('__logmsg')
logger.addstmt(StmtDecl(Decl(Type('std::string'), msgvar.name))) logger.addstmt(StmtDecl(Decl(Type('std::string'), msgvar.name)))
@ -1911,7 +1911,7 @@ stmt. Some types generate both kinds.'''
def maybeTypedef(self, fqname, name): def maybeTypedef(self, fqname, name):
if fqname != name or self.unqualifiedTypedefs: if fqname != name or self.unqualifiedTypedefs:
self.usingTypedefs.append(Typedef(Type(fqname), name)) self.usingTypedefs.append(Typedef(Type(fqname), name))
def visitBuiltinCxxType(self, t): def visitBuiltinCxxType(self, t):
if t in self.visited: return if t in self.visited: return
self.visited.add(t) self.visited.add(t)
@ -2628,7 +2628,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
'include', 'include',
'"'+ _protocolHeaderName(self.protocol, self.side) +'.h"') ] '"'+ _protocolHeaderName(self.protocol, self.side) +'.h"') ]
+ setToIncludes(self.externalIncludes)) + setToIncludes(self.externalIncludes))
if self.protocol.decl.type.isToplevel(): if self.protocol.decl.type.isToplevel():
cf.addthings([ cf.addthings([
CppDirective('ifdef', 'MOZ_CRASHREPORTER'), CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
@ -2808,7 +2808,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
# add the Alloc/Dealloc interface for managed actors # add the Alloc/Dealloc interface for managed actors
actortype = md.actorDecl().bareType(self.side) actortype = md.actorDecl().bareType(self.side)
self.cls.addstmt(StmtDecl(MethodDecl( self.cls.addstmt(StmtDecl(MethodDecl(
_allocMethod(managed, self.side).name, _allocMethod(managed, self.side).name,
params=md.makeCxxParams(side=self.side, implicit=0), params=md.makeCxxParams(side=self.side, implicit=0),
@ -3019,7 +3019,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ret=p.managedVarType(managed, self.side, const=1, ref=1), ret=p.managedVarType(managed, self.side, const=1, ref=1),
const=1)) const=1))
refmeth.addstmt(StmtReturn(p.managedVar(managed, self.side))) refmeth.addstmt(StmtReturn(p.managedVar(managed, self.side)))
self.cls.addstmts([ meth, refmeth, Whitespace.NL ]) self.cls.addstmts([ meth, refmeth, Whitespace.NL ])
statemethod = MethodDefn(MethodDecl( statemethod = MethodDefn(MethodDecl(
@ -3337,7 +3337,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
## private methods ## private methods
self.cls.addstmt(Label.PRIVATE) self.cls.addstmt(Label.PRIVATE)
## FatalError() ## FatalError()
msgparam = ExprVar('aMsg') msgparam = ExprVar('aMsg')
msgvar = ExprVar('formattedMessage') msgvar = ExprVar('formattedMessage')
actorname = _actorName(p.name, self.side) actorname = _actorName(p.name, self.side)
@ -3803,7 +3803,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
CaseLabel('SHMEM_CREATED_MESSAGE_TYPE'), abort) CaseLabel('SHMEM_CREATED_MESSAGE_TYPE'), abort)
self.asyncSwitch.addcase( self.asyncSwitch.addcase(
CaseLabel('SHMEM_DESTROYED_MESSAGE_TYPE'), abort) CaseLabel('SHMEM_DESTROYED_MESSAGE_TYPE'), abort)
otherprocess.addstmt(StmtReturn(p.otherProcessVar())) otherprocess.addstmt(StmtReturn(p.otherProcessVar()))
getchannel.addstmt(StmtReturn(ExprAddrOf(p.channelVar()))) getchannel.addstmt(StmtReturn(ExprAddrOf(p.channelVar())))
else: else:
@ -4418,7 +4418,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
StmtReturn.FALSE StmtReturn.FALSE
]) ])
read.addstmts([ ifbadid, Whitespace.NL ]) read.addstmts([ ifbadid, Whitespace.NL ])
# if (NULL_ID == id) # if (NULL_ID == id)
# *var = null # *var = null
# return true # return true
@ -4624,7 +4624,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
sd = structtype._ast sd = structtype._ast
write = MethodDefn(self.writeMethodDecl(intype, var)) write = MethodDefn(self.writeMethodDecl(intype, var))
read = MethodDefn(self.readMethodDecl(outtype, var)) read = MethodDefn(self.readMethodDecl(outtype, var))
def get(sel, f): def get(sel, f):
return ExprCall(f.getMethod(thisexpr=var, sel=sel)) return ExprCall(f.getMethod(thisexpr=var, sel=sel))
@ -4811,7 +4811,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
# XXX figure out what to do here # XXX figure out what to do here
if isdtor and md.decl.type.constructedType().isToplevel(): if isdtor and md.decl.type.constructedType().isToplevel():
sendmethod = None sendmethod = None
if sendmethod is not None: if sendmethod is not None:
self.cls.addstmts([ sendmethod, Whitespace.NL ]) self.cls.addstmts([ sendmethod, Whitespace.NL ])
if recvcase is not None: if recvcase is not None:
@ -4910,7 +4910,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
actorvar = md.actorDecl().var() actorvar = md.actorDecl().var()
type = md.decl.type.constructedType() type = md.decl.type.constructedType()
failif = StmtIf(cond) failif = StmtIf(cond)
if self.side=='child': if self.side=='child':
# in the child process this should not fail # in the child process this should not fail
failif.addifstmt(_runtimeAbort('constructor for actor failed')) failif.addifstmt(_runtimeAbort('constructor for actor failed'))
@ -5099,7 +5099,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
+ self.makeReply(md, errfnRecv, routingId=idvar) + self.makeReply(md, errfnRecv, routingId=idvar)
+ [ Whitespace.NL, + [ Whitespace.NL,
StmtReturn(_Result.Processed) ]) StmtReturn(_Result.Processed) ])
return lbl, case return lbl, case
@ -5172,7 +5172,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
def setMessageFlags(self, md, var, reply, routingId=None): def setMessageFlags(self, md, var, reply, routingId=None):
if routingId is None: if routingId is None:
routingId = self.protocol.routingId() routingId = self.protocol.routingId()
stmts = [ StmtExpr(ExprCall( stmts = [ StmtExpr(ExprCall(
ExprSelect(var, '->', 'set_routing_id'), ExprSelect(var, '->', 'set_routing_id'),
args=[ routingId ])) ] args=[ routingId ])) ]
@ -5344,7 +5344,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
implicit=implicit)))) implicit=implicit))))
failif.addifstmts([ failif.addifstmts([
_protocolErrorBreakpoint('Handler for '+ md.name +' returned error code'), _protocolErrorBreakpoint('Handler for '+ md.name +' returned error code'),
StmtReturn(_Result.ProcessingError) StmtReturn(_Result.ProcessingError)
]) ])
return [ failif ] return [ failif ]
@ -5394,7 +5394,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
def transition(self, md, direction, actor=None, reply=False): def transition(self, md, direction, actor=None, reply=False):
if actor is not None: stateexpr = _actorState(actor) if actor is not None: stateexpr = _actorState(actor)
else: stateexpr = self.protocol.stateVar() else: stateexpr = self.protocol.stateVar()
if (self.side is 'parent' and direction is 'out' if (self.side is 'parent' and direction is 'out'
or self.side is 'child' and direction is 'in'): or self.side is 'child' and direction is 'in'):
action = ExprVar('Trigger::Send') action = ExprVar('Trigger::Send')
@ -5537,7 +5537,7 @@ class _GenerateSkeletonImpl(Visitor):
ctor.addstmt(StmtExpr(ExprCall(ExprVar( 'MOZ_COUNT_CTOR'), ctor.addstmt(StmtExpr(ExprCall(ExprVar( 'MOZ_COUNT_CTOR'),
[ ExprVar(self.name) ]))) [ ExprVar(self.name) ])))
self.addmethodimpl(ctor) self.addmethodimpl(ctor)
def visitDestructorDecl(self, dd): def visitDestructorDecl(self, dd):
self.cls.addstmt( self.cls.addstmt(
StmtDecl(DestructorDecl(self.name, virtual=1))) StmtDecl(DestructorDecl(self.name, virtual=1)))