Skip to content

Commit

Permalink
Bug 1346345 - Implement != operator for IPDL structs. r=kanru
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: H1CDbuXZ5U0

--HG--
extra : rebase_source : 88005a00cf7c9625179b63354d8947635fcf8d2a
  • Loading branch information
amccreight committed Mar 10, 2017
1 parent 2d0b942 commit 91a4a0b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ipc/ipdl/ipdl/lower.py
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,16 @@ def assignFromOther(oexpr):
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:
Expand Down

0 comments on commit 91a4a0b

Please sign in to comment.