Bug 1335000 - return type& for copy assignment operator. r=peterv

MozReview-Commit-ID: 7kHt2l30ZP6

--HG--
extra : rebase_source : 3ef1cb0583238d9508153f4ddbbd402930f70706
This commit is contained in:
Andi-Bogdan Postelnicu 2017-02-01 17:54:49 +02:00
Родитель b9fcaa1663
Коммит b877576a5c
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -10234,10 +10234,13 @@ class CGUnionStruct(CGThing):
visibility="public",
explicit=True,
body="*this = aOther;\n"))
op_body = CGList([])
op_body.append(CGSwitch("aOther.mType", assignmentCases))
op_body.append(CGGeneric("return *this;\n"))
methods.append(ClassMethod(
"operator=", "void",
"operator=", "%s&" % selfName,
[Argument("const %s&" % selfName, "aOther")],
body=CGSwitch("aOther.mType", assignmentCases).define()))
body=op_body.define()))
disallowCopyConstruction = False
else:
disallowCopyConstruction = True
@ -10872,7 +10875,7 @@ class CGClass(CGThing):
def declare(self, cgClass):
name = cgClass.getNameString()
return ("%s(const %s&) = delete;\n"
"void operator=(const %s&) = delete;\n" % (name, name, name))
"%s& operator=(const %s&) = delete;\n" % (name, name, name, name))
disallowedCopyConstructors = [DisallowedCopyConstructor()]
else:
@ -12993,8 +12996,9 @@ class CGDictionary(CGThing):
memberAssign = CGGeneric(
"%s = aOther.%s;\n" % (memberName, memberName))
body.append(memberAssign)
body.append(CGGeneric("return *this;\n"))
return ClassMethod(
"operator=", "void",
"operator=", "%s&" % self.makeClassName(self.dictionary),
[Argument("const %s&" % self.makeClassName(self.dictionary),
"aOther")],
body=body.define())