зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1838703 - [dom/bindings] Mark SetAsFoo() as nodiscard. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D181140
This commit is contained in:
Родитель
1f4f920af8
Коммит
8acce1d525
|
@ -6340,7 +6340,9 @@ def getJSToNativeConversionInfo(
|
|||
ctorArgs = ""
|
||||
# It's enough to set us to the right type; that will
|
||||
# create an empty array, which is all we need here.
|
||||
default = CGGeneric("%s.RawSetAs%s(%s);\n" % (value, name, ctorArgs))
|
||||
default = CGGeneric(
|
||||
"Unused << %s.RawSetAs%s(%s);\n" % (value, name, ctorArgs)
|
||||
)
|
||||
elif defaultValue.type.isEnum():
|
||||
name = getUnionMemberName(defaultValue.type)
|
||||
# Make sure we actually construct the thing inside the nullable.
|
||||
|
@ -12867,6 +12869,7 @@ class CGUnionStruct(CGThing):
|
|||
vars["ctorArgList"],
|
||||
bodyInHeader=not self.ownsMembers,
|
||||
body=body % "MOZ_ASSERT(mType == eUninitialized);",
|
||||
noDiscard=True,
|
||||
)
|
||||
)
|
||||
methods.append(
|
||||
|
@ -12876,6 +12879,7 @@ class CGUnionStruct(CGThing):
|
|||
vars["ctorArgList"],
|
||||
bodyInHeader=not self.ownsMembers,
|
||||
body=body % uninit,
|
||||
noDiscard=True,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -13295,6 +13299,7 @@ class ClassMethod(ClassItem):
|
|||
breakAfterSelf="\n",
|
||||
override=False,
|
||||
canRunScript=False,
|
||||
noDiscard=False,
|
||||
):
|
||||
"""
|
||||
override indicates whether to flag the method as override
|
||||
|
@ -13314,10 +13319,13 @@ class ClassMethod(ClassItem):
|
|||
self.breakAfterSelf = breakAfterSelf
|
||||
self.override = override
|
||||
self.canRunScript = canRunScript
|
||||
self.noDiscard = noDiscard
|
||||
ClassItem.__init__(self, name, visibility)
|
||||
|
||||
def getDecorators(self, declaring):
|
||||
decorators = []
|
||||
if self.noDiscard:
|
||||
decorators.append("[[nodiscard]]")
|
||||
if self.canRunScript:
|
||||
decorators.append("MOZ_CAN_RUN_SCRIPT")
|
||||
if self.inline:
|
||||
|
|
|
@ -91,7 +91,7 @@ class WebCryptoTask : public CancelableRunnable {
|
|||
CryptoKey& aKey,
|
||||
const CryptoOperationData& aData) {
|
||||
CryptoOperationData dummy;
|
||||
dummy.SetAsArrayBuffer(aCx);
|
||||
Unused << dummy.SetAsArrayBuffer(aCx);
|
||||
return CreateSignVerifyTask(aCx, aAlgorithm, aKey, dummy, aData, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -2528,7 +2528,7 @@ static void ReduceConstraint(
|
|||
aConstraint.SetAsMediaTrackConstraints().mMediaSource.Construct(
|
||||
*mediaSource);
|
||||
} else {
|
||||
aConstraint.SetAsMediaTrackConstraints();
|
||||
Unused << aConstraint.SetAsMediaTrackConstraints();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ nsresult NS_NewDOMDocument(Document** aInstancePtrResult,
|
|||
if (!aQualifiedName.IsEmpty()) {
|
||||
ErrorResult result;
|
||||
ElementCreationOptionsOrString options;
|
||||
options.SetAsString();
|
||||
Unused << options.SetAsString();
|
||||
|
||||
nsCOMPtr<Element> root =
|
||||
d->CreateElementNS(aNamespaceURI, aQualifiedName, options, result);
|
||||
|
|
|
@ -988,7 +988,7 @@ void txMozillaXSLTProcessor::notifyError() {
|
|||
|
||||
IgnoredErrorResult rv;
|
||||
ElementCreationOptionsOrString options;
|
||||
options.SetAsString();
|
||||
Unused << options.SetAsString();
|
||||
|
||||
nsCOMPtr<Element> element =
|
||||
document->CreateElementNS(ns, u"parsererror"_ns, options, rv);
|
||||
|
@ -1010,7 +1010,7 @@ void txMozillaXSLTProcessor::notifyError() {
|
|||
|
||||
if (!mSourceText.IsEmpty()) {
|
||||
ElementCreationOptionsOrString options;
|
||||
options.SetAsString();
|
||||
Unused << options.SetAsString();
|
||||
|
||||
nsCOMPtr<Element> sourceElement =
|
||||
document->CreateElementNS(ns, u"sourcetext"_ns, options, rv);
|
||||
|
|
Загрузка…
Ссылка в новой задаче