Add default initializers for primitive fields in IPDL structs. (bug 1154522, r=billm)

This commit is contained in:
David Anderson 2015-07-28 00:02:10 -07:00
parent 1b782a5d02
commit 6a1a144862

View File

@ -2057,6 +2057,12 @@ def _generateCxxStruct(sd):
# Struct()
defctor = ConstructorDefn(ConstructorDecl(sd.name))
defctor.addstmt(StmtExpr(callinit))
defctor.memberinits = []
for f in sd.fields:
# Only generate default values for primitives.
if not (f.ipdltype.isCxx() and f.ipdltype.isAtom()):
continue
defctor.memberinits.append(ExprMemberInit(f.memberVar()))
struct.addstmts([ defctor, Whitespace.NL ])
# Struct(const field1& _f1, ...)