From 99532db648bffefa0f6e85c2aa7a0cf58b6e68ac Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 18 Dec 2018 20:58:09 +0000 Subject: [PATCH] Bug 1515170 - in the IPDL compiler, don't use 'is' for comparing strings; r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D14889 --- ipc/ipdl/ipdl/lower.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index 785335ab1ad60..9a05b5734259a 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -1013,11 +1013,11 @@ def makeCxxParams(self, paramsems='in', returnsems='out', |params| and |returns| is the C++ semantics of those: 'in', 'out', or None.""" def makeDecl(d, sems): - if sems is 'in': + if sems == 'in': return Decl(d.inType(side), d.name) - elif sems is 'move': + elif sems == 'move': return Decl(d.moveType(side), d.name) - elif sems is 'out': + elif sems == 'out': return Decl(d.outType(side), d.name) else: assert 0 @@ -1041,12 +1041,12 @@ def makeCallbackRejectDecl(returns): if paramsems is not None: cxxparams.extend([makeDecl(d, paramsems) for d in self.params]) - if returnsems is 'promise' and self.returns: + if returnsems == 'promise' and self.returns: pass - elif returnsems is 'callback' and self.returns: + elif returnsems == 'callback' and self.returns: cxxparams.extend([makeCallbackResolveDecl(self.returns), makeCallbackRejectDecl(self.returns)]) - elif returnsems is 'resolver' and self.returns: + elif returnsems == 'resolver' and self.returns: cxxparams.extend([makeResolverDecl(self.returns)]) elif returnsems is not None: cxxparams.extend([makeDecl(r, returnsems) for r in self.returns]) @@ -1061,31 +1061,31 @@ def makeCxxArgs(self, paramsems='in', retsems='out', retcallsems='out', assert not retcallsems or retsems # retcallsems => returnsems cxxargs = [] - if paramsems is 'move': + if paramsems == 'move': cxxargs.extend([p.mayMoveExpr() for p in self.params]) - elif paramsems is 'in': + elif paramsems == 'in': cxxargs.extend([p.var() for p in self.params]) else: assert False for ret in self.returns: - if retsems is 'in': - if retcallsems is 'in': + if retsems == 'in': + if retcallsems == 'in': cxxargs.append(ret.var()) - elif retcallsems is 'out': + elif retcallsems == 'out': cxxargs.append(ExprAddrOf(ret.var())) else: assert 0 - elif retsems is 'out': - if retcallsems is 'in': + elif retsems == 'out': + if retcallsems == 'in': cxxargs.append(ExprDeref(ret.var())) - elif retcallsems is 'out': + elif retcallsems == 'out': cxxargs.append(ret.var()) else: assert 0 - elif retsems is 'resolver': + elif retsems == 'resolver': pass - if retsems is 'resolver': + if retsems == 'resolver': cxxargs.append(ExprMove(ExprVar('resolver'))) if not implicit: @@ -3055,7 +3055,7 @@ def visitProtocol(self, p): viz='public')) self.hdrfile.addthing(CppDirective('include', '"mozilla/WeakPtr.h"')) - if ptype.isToplevel() and self.side is 'parent': + if ptype.isToplevel() and self.side == 'parent': self.hdrfile.addthings([ _makeForwardDeclForQClass('nsIFile', []), Whitespace.NL