Bug 1346345 - Implement != operator for IPDL structs. r=kanru

MozReview-Commit-ID: H1CDbuXZ5U0

--HG--
extra : rebase_source : 88005a00cf7c9625179b63354d8947635fcf8d2a
This commit is contained in:
Andrew McCreight 2017-03-10 11:42:07 -08:00
parent 2d0b942fdc
commit 91a4a0b1a5

View File

@ -1833,6 +1833,16 @@ def _generateCxxStruct(sd):
opeqeq.addstmt(StmtReturn.TRUE)
struct.addstmts([ opeqeq, Whitespace.NL ])
# bool operator!=(const Struct& _o)
opneq = MethodDefn(MethodDecl(
'operator!=',
params=[ Decl(constreftype, ovar.name) ],
ret=Type.BOOL,
const=1))
opneq.addstmt(StmtReturn(ExprNot(ExprCall(ExprVar('operator=='),
args=[ ovar ]))))
struct.addstmts([ opneq, Whitespace.NL ])
# field1& f1()
# const field1& f1() const
for f in sd.fields: