Compare commits
24
Commits
master
...
c++17-work
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
610e44320c | ||
|
|
10476e27da | ||
|
|
a4777b1c21 | ||
|
|
9f6e448f78 | ||
|
|
19a21bac1b | ||
|
|
c7867ce130 | ||
|
|
34c068e611 | ||
|
|
a48e621048 | ||
|
|
de5d3b1034 | ||
|
|
f8737bbf4f | ||
|
|
d9c70eaba2 | ||
|
|
9308c63ce6 | ||
|
|
6314e01691 | ||
|
|
b7b2f1de84 | ||
|
|
b838d6634c | ||
|
|
dc4ea7f680 | ||
|
|
0e427867e3 | ||
|
|
8137a4e122 | ||
|
|
46138995f6 | ||
|
|
aeb9de40a5 | ||
|
|
3d693801f9 | ||
|
|
14fa712b8c | ||
|
|
7d93034fd0 | ||
|
|
1769e74839 |
No files matched your search
@@ -22,4 +22,4 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Removal of SIMD.js and associated scalar types requires CLOBBER. (Issue #2307)
|
||||
Switching to C++17 requires CLOBBER to pick up compiler conf. (Issue #2281)
|
||||
@@ -176,7 +176,7 @@ private:
|
||||
uint32_t AddSubtree(ProxyAccessible* aParent,
|
||||
const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
|
||||
uint32_t aIdxInParent);
|
||||
MOZ_MUST_USE bool CheckDocTree() const;
|
||||
[[nodiscard]] bool CheckDocTree() const;
|
||||
xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
|
||||
|
||||
nsTArray<DocAccessibleParent*> mChildDocs;
|
||||
|
||||
@@ -173,7 +173,7 @@ public: // construction, destruction
|
||||
/**
|
||||
* Find an accessible by the given child ID in cached documents.
|
||||
*/
|
||||
MOZ_MUST_USE already_AddRefed<IAccessible>
|
||||
[[nodiscard]] already_AddRefed<IAccessible>
|
||||
GetIAccessibleFor(const VARIANT& aVarChild, bool* aIsDefunct);
|
||||
|
||||
virtual void GetNativeInterface(void **aOutAccessible) override;
|
||||
@@ -198,7 +198,7 @@ protected:
|
||||
/**
|
||||
* Find a remote accessible by the given child ID.
|
||||
*/
|
||||
MOZ_MUST_USE already_AddRefed<IAccessible>
|
||||
[[nodiscard]] already_AddRefed<IAccessible>
|
||||
GetRemoteIAccessibleFor(const VARIANT& aVarChild);
|
||||
|
||||
/**
|
||||
|
||||
@@ -340,17 +340,16 @@ def check_compiler(compiler, language, target):
|
||||
if info.type in ('clang-cl', 'clang', 'gcc'):
|
||||
append_flag('-std=gnu99')
|
||||
|
||||
# Note: this is a strict version check because we used to always add
|
||||
# -std=gnu++14.
|
||||
cxx14_version = 201402
|
||||
cxx17_version = 201703
|
||||
if info.language == 'C++':
|
||||
if info.type in ('clang', 'gcc') and info.language_version != cxx14_version:
|
||||
append_flag('-std=gnu++14')
|
||||
# MSVC 2015 headers include C++14 features, but don't guard them
|
||||
# with appropriate checks.
|
||||
if info.type == 'clang-cl' and info.language_version != cxx14_version:
|
||||
append_flag('-std=c++14')
|
||||
# MSVC from 2015 on defaults to C++14.
|
||||
if info.language_version != cxx17_version:
|
||||
# Compiler doesn't default to C++17, so add the appropriate flag.
|
||||
if info.type in ('clang', 'gcc'):
|
||||
# We're on Clang or GCC, enable C++17 and add GNU extensions.
|
||||
append_flag('-std=gnu++17')
|
||||
else:
|
||||
# We're on MSVC; enable C++17 language mode.
|
||||
append_flag('-std:c++17')
|
||||
|
||||
# We force clang-cl to emulate Visual C++ 2015 Update 3 with fallback to
|
||||
# cl.exe.
|
||||
|
||||
@@ -52,7 +52,7 @@ check_and_add_gcc_warning('-Wclass-varargs')
|
||||
check_and_add_gcc_warning('-Wloop-analysis')
|
||||
|
||||
# catches C++ version forward-compat issues
|
||||
check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler)
|
||||
# check_and_add_gcc_warning('-Wc++2a-compat', cxx_compiler)
|
||||
|
||||
# catches unintentional switch case fallthroughs
|
||||
check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler)
|
||||
|
||||
@@ -51,12 +51,12 @@ public:
|
||||
// Don't use this method for anything else than debugging!
|
||||
void CreateAnonymizedSuffix(nsACString& aStr) const;
|
||||
|
||||
MOZ_MUST_USE bool PopulateFromSuffix(const nsACString& aStr);
|
||||
[[nodiscard]] bool PopulateFromSuffix(const nsACString& aStr);
|
||||
|
||||
// Populates the attributes from a string like
|
||||
// |uri!key1=value1&key2=value2| and returns the uri without the suffix.
|
||||
MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
nsACString& aOriginNoSuffix);
|
||||
[[nodiscard]] bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
nsACString& aOriginNoSuffix);
|
||||
|
||||
// Helper function to match mIsPrivateBrowsing to existing private browsing
|
||||
// flags. Once all other flags are removed, this can be removed too.
|
||||
|
||||
@@ -147,8 +147,7 @@ public:
|
||||
virtual bool TextIsOnlyWhitespace() override;
|
||||
virtual bool HasTextForTranslation() override;
|
||||
virtual void AppendTextTo(nsAString& aResult) override;
|
||||
MOZ_MUST_USE
|
||||
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
|
||||
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
|
||||
virtual nsIContent *GetBindingParent() const override;
|
||||
virtual nsXBLBinding *GetXBLBinding() const override;
|
||||
virtual void SetXBLBinding(nsXBLBinding* aBinding,
|
||||
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
nsIContent **outImageOrLinkNode,
|
||||
bool* outDragSelectedText);
|
||||
static already_AddRefed<nsIContent> FindParentLinkNode(nsIContent* inNode);
|
||||
static MOZ_MUST_USE nsresult
|
||||
static [[nodiscard]] nsresult
|
||||
GetAnchorURL(nsIContent* inNode, nsAString& outURL);
|
||||
static void GetNodeString(nsIContent* inNode, nsAString & outNodeString);
|
||||
static void CreateLinkText(const nsAString& inURL, const nsAString & inText,
|
||||
|
||||
+20
-19
@@ -1508,9 +1508,10 @@ public:
|
||||
* @param aResult the result. Out param.
|
||||
* @return false on out of memory errors, true otherwise.
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
static bool GetNodeTextContent(nsINode* aNode, bool aDeep,
|
||||
nsAString& aResult, const mozilla::fallible_t&);
|
||||
[[nodiscard]] static bool GetNodeTextContent(nsINode* aNode,
|
||||
bool aDeep,
|
||||
nsAString& aResult,
|
||||
const mozilla::fallible_t&);
|
||||
|
||||
static void GetNodeTextContent(nsINode* aNode, bool aDeep,
|
||||
nsAString& aResult);
|
||||
@@ -1869,28 +1870,29 @@ public:
|
||||
*/
|
||||
static bool CanAccessNativeAnon();
|
||||
|
||||
MOZ_MUST_USE
|
||||
static nsresult WrapNative(JSContext *cx, nsISupports *native,
|
||||
const nsIID* aIID, JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = true)
|
||||
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
|
||||
nsISupports* native,
|
||||
const nsIID* aIID,
|
||||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = true)
|
||||
{
|
||||
return WrapNative(cx, native, nullptr, aIID, vp, aAllowWrapping);
|
||||
}
|
||||
|
||||
// Same as the WrapNative above, but use this one if aIID is nsISupports' IID.
|
||||
MOZ_MUST_USE
|
||||
static nsresult WrapNative(JSContext *cx, nsISupports *native,
|
||||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = true)
|
||||
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
|
||||
nsISupports* native,
|
||||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = true)
|
||||
{
|
||||
return WrapNative(cx, native, nullptr, nullptr, vp, aAllowWrapping);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE
|
||||
static nsresult WrapNative(JSContext *cx, nsISupports *native,
|
||||
nsWrapperCache *cache,
|
||||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = true)
|
||||
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
|
||||
nsISupports* native,
|
||||
nsWrapperCache* cache,
|
||||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping = true)
|
||||
{
|
||||
return WrapNative(cx, native, cache, nullptr, vp, aAllowWrapping);
|
||||
}
|
||||
@@ -1914,9 +1916,8 @@ public:
|
||||
* @param aString the string to convert the newlines inside [in/out]
|
||||
*/
|
||||
static void PlatformToDOMLineBreaks(nsString &aString);
|
||||
MOZ_MUST_USE
|
||||
static bool PlatformToDOMLineBreaks(nsString &aString,
|
||||
const mozilla::fallible_t&);
|
||||
[[nodiscard]] static bool PlatformToDOMLineBreaks(nsString &aString,
|
||||
const mozilla::fallible_t&);
|
||||
|
||||
/**
|
||||
* Populates aResultString with the contents of the string-buffer aBuf, up
|
||||
|
||||
@@ -144,9 +144,8 @@ public:
|
||||
virtual bool TextIsOnlyWhitespace() override;
|
||||
virtual bool HasTextForTranslation() override;
|
||||
virtual void AppendTextTo(nsAString& aResult) override;
|
||||
MOZ_MUST_USE
|
||||
virtual bool AppendTextTo(nsAString& aResult,
|
||||
const mozilla::fallible_t&) override;
|
||||
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult,
|
||||
const mozilla::fallible_t&) override;
|
||||
virtual void SaveSubtreeState() override;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -37,18 +37,16 @@ class nsHTMLContentSerializer final : public nsXHTMLContentSerializer {
|
||||
nsAString& aStr) override;
|
||||
protected:
|
||||
|
||||
MOZ_MUST_USE
|
||||
virtual bool SerializeHTMLAttributes(nsIContent* aContent,
|
||||
nsIContent *aOriginalElement,
|
||||
nsAString& aTagPrefix,
|
||||
const nsAString& aTagNamespaceURI,
|
||||
nsIAtom* aTagName,
|
||||
int32_t aNamespace,
|
||||
nsAString& aStr);
|
||||
[[nodiscard]] virtual bool SerializeHTMLAttributes(nsIContent* aContent,
|
||||
nsIContent* aOriginalElement,
|
||||
nsAString& aTagPrefix,
|
||||
const nsAString& aTagNamespaceURI,
|
||||
nsIAtom* aTagName,
|
||||
int32_t aNamespace,
|
||||
nsAString& aStr);
|
||||
|
||||
MOZ_MUST_USE
|
||||
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
|
||||
nsAString& aOutputStr) override;
|
||||
[[nodiscard]] virtual bool AppendAndTranslateEntities(const nsAString& aStr,
|
||||
nsAString& aOutputStr) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -576,8 +576,7 @@ public:
|
||||
* Append the text content to aResult.
|
||||
* NOTE: This asserts and returns for elements
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
|
||||
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
|
||||
|
||||
/**
|
||||
* Check if this content is focusable and in the current tab order.
|
||||
|
||||
@@ -2513,8 +2513,8 @@ public:
|
||||
mozilla::ErrorResult& rv);
|
||||
virtual mozilla::dom::DOMImplementation*
|
||||
GetImplementation(mozilla::ErrorResult& rv) = 0;
|
||||
MOZ_MUST_USE nsresult GetURL(nsString& retval) const;
|
||||
MOZ_MUST_USE nsresult GetDocumentURI(nsString& retval) const;
|
||||
[[nodiscard]] nsresult GetURL(nsString& retval) const;
|
||||
[[nodiscard]] nsresult GetDocumentURI(nsString& retval) const;
|
||||
// Return the URI for the document.
|
||||
// The returned value may differ if the document is loaded via XHR, and
|
||||
// when accessed from chrome privileged script and
|
||||
|
||||
+1
-1
@@ -1873,7 +1873,7 @@ public:
|
||||
aNodeName.SetStringBuffer(nsStringBuffer::FromString(nodeName),
|
||||
nodeName.Length());
|
||||
}
|
||||
MOZ_MUST_USE nsresult GetBaseURI(nsAString& aBaseURI) const;
|
||||
[[nodiscard]] nsresult GetBaseURI(nsAString& aBaseURI) const;
|
||||
// Return the base URI for the document.
|
||||
// The returned value may differ if the document is loaded via XHR, and
|
||||
// when accessed from chrome privileged script and
|
||||
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
// After getting a notification that an off-thread compilation terminated,
|
||||
// this function will take the result of the parser and move it to the main
|
||||
// thread.
|
||||
MOZ_MUST_USE nsresult JoinCompile(void** aOffThreadToken);
|
||||
[[nodiscard]] nsresult JoinCompile(void** aOffThreadToken);
|
||||
|
||||
// Compile a script contained in a SourceText.
|
||||
nsresult Compile(JS::CompileOptions& aCompileOptions,
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
JSScript* GetScript();
|
||||
|
||||
// Execute the compiled script and ignore the return value.
|
||||
MOZ_MUST_USE nsresult ExecScript();
|
||||
[[nodiscard]] nsresult ExecScript();
|
||||
|
||||
// Execute the compiled script a get the return value.
|
||||
//
|
||||
@@ -180,10 +180,10 @@ public:
|
||||
// compartment given as argument to the ExecutionContext constructor. If the
|
||||
// caller is in a different compartment, then the out-param value should be
|
||||
// wrapped by calling |JS_WrapValue|.
|
||||
MOZ_MUST_USE nsresult
|
||||
[[nodiscard]] nsresult
|
||||
ExtractReturnValue(JS::MutableHandle<JS::Value> aRetValue);
|
||||
|
||||
MOZ_MUST_USE nsresult ExecScript(JS::MutableHandle<JS::Value> aRetValue);
|
||||
[[nodiscard]] nsresult ExecScript(JS::MutableHandle<JS::Value> aRetValue);
|
||||
};
|
||||
|
||||
static nsresult CompileModule(JSContext* aCx,
|
||||
|
||||
@@ -382,7 +382,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
void GetNestedParams(nsTArray<mozilla::dom::MozPluginParameter>& aParameters,
|
||||
bool aIgnoreCodebase);
|
||||
|
||||
MOZ_MUST_USE nsresult BuildParametersArray();
|
||||
[[nodiscard]] nsresult BuildParametersArray();
|
||||
|
||||
/**
|
||||
* Loads fallback content with the specified FallbackType
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
* Append the contents of this string fragment to aString
|
||||
* @return false if an out of memory condition is detected, true otherwise
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendTo(nsAString& aString,
|
||||
const mozilla::fallible_t& aFallible) const {
|
||||
if (mState.mIs2b) {
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
* @param aLength the length of the substring
|
||||
* @return false if an out of memory condition is detected, true otherwise
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendTo(nsAString& aString, int32_t aOffset, int32_t aLength,
|
||||
const mozilla::fallible_t& aFallible) const
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
|
||||
nsAString& aStr,
|
||||
nsresult& aResult) override;
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
virtual bool AfterElementStart(nsIContent* aContent,
|
||||
nsIContent* aOriginalElement,
|
||||
nsAString& aStr) override;
|
||||
@@ -70,7 +70,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
|
||||
virtual void MaybeEnterInPreContent(nsIContent* aNode) override;
|
||||
virtual void MaybeLeaveFromPreContent(nsIContent* aNode) override;
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
virtual bool SerializeAttributes(nsIContent* aContent,
|
||||
nsIContent *aOriginalElement,
|
||||
nsAString& aTagPrefix,
|
||||
@@ -82,13 +82,13 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
|
||||
|
||||
bool IsFirstChildOfOL(nsIContent* aElement);
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool SerializeLIValueAttribute(nsIContent* aElement,
|
||||
nsAString& aStr);
|
||||
bool IsShorthandAttr(const nsIAtom* aAttrName,
|
||||
const nsIAtom* aElementName);
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
|
||||
nsAString& aOutputStr) override;
|
||||
|
||||
|
||||
@@ -72,23 +72,21 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
/**
|
||||
* Appends a char16_t character and increments the column position
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
bool AppendToString(const char16_t aChar,
|
||||
nsAString& aOutputStr);
|
||||
[[nodiscard]] bool AppendToString(const char16_t aChar,
|
||||
nsAString& aOutputStr);
|
||||
|
||||
/**
|
||||
* Appends a nsAString string and increments the column position
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
bool AppendToString(const nsAString& aStr,
|
||||
nsAString& aOutputStr);
|
||||
[[nodiscard]] bool AppendToString(const nsAString& aStr,
|
||||
nsAString& aOutputStr);
|
||||
|
||||
/**
|
||||
* Appends a string by replacing all line-endings
|
||||
* by mLineBreak, except in the case of raw output.
|
||||
* It increments the column position.
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendToStringConvertLF(const nsAString& aStr,
|
||||
nsAString& aOutputStr);
|
||||
|
||||
@@ -96,7 +94,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
* Appends a string by wrapping it when necessary.
|
||||
* It updates the column position.
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendToStringWrapped(const nsASingleFragmentString& aStr,
|
||||
nsAString& aOutputStr);
|
||||
|
||||
@@ -104,12 +102,12 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
* Appends a string by formating and wrapping it when necessary
|
||||
* It updates the column position.
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendToStringFormatedWrapped(const nsASingleFragmentString& aStr,
|
||||
nsAString& aOutputStr);
|
||||
|
||||
// used by AppendToStringWrapped
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendWrapped_WhitespaceSequence(
|
||||
nsASingleFragmentString::const_char_iterator &aPos,
|
||||
const nsASingleFragmentString::const_char_iterator aEnd,
|
||||
@@ -117,7 +115,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
nsAString &aOutputStr);
|
||||
|
||||
// used by AppendToStringFormatedWrapped
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendFormatedWrapped_WhitespaceSequence(
|
||||
nsASingleFragmentString::const_char_iterator &aPos,
|
||||
const nsASingleFragmentString::const_char_iterator aEnd,
|
||||
@@ -126,7 +124,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
nsAString &aOutputStr);
|
||||
|
||||
// used by AppendToStringWrapped and AppendToStringFormatedWrapped
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendWrapped_NonWhitespaceSequence(
|
||||
nsASingleFragmentString::const_char_iterator &aPos,
|
||||
const nsASingleFragmentString::const_char_iterator aEnd,
|
||||
@@ -139,7 +137,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
* add mLineBreak to the string
|
||||
* It updates the column position and other flags.
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendNewLineToString(nsAString& aOutputStr);
|
||||
|
||||
|
||||
@@ -147,7 +145,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
* Appends a string by translating entities
|
||||
* It doesn't increment the column position
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
|
||||
nsAString& aOutputStr);
|
||||
|
||||
@@ -197,7 +195,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
nsIContent *aOriginalElement,
|
||||
const nsAString& aTagNamespaceURI);
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
virtual bool SerializeAttributes(nsIContent* aContent,
|
||||
nsIContent *aOriginalElement,
|
||||
nsAString& aTagPrefix,
|
||||
@@ -207,7 +205,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
uint32_t aSkipAttr,
|
||||
bool aAddNSAttr);
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool SerializeAttr(const nsAString& aPrefix,
|
||||
const nsAString& aName,
|
||||
const nsAString& aValue,
|
||||
@@ -239,7 +237,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
* aElement and aOriginalElement are the same as the corresponding arguments
|
||||
* to AppendElementStart.
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool AppendEndOfElementStart(mozilla::dom::Element* aEleemnt,
|
||||
mozilla::dom::Element* aOriginalElement,
|
||||
nsAString& aStr);
|
||||
@@ -249,7 +247,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
* after the serialization ot the start tag.
|
||||
* (called at the end of AppendElementStart)
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
virtual bool AfterElementStart(nsIContent* aContent,
|
||||
nsIContent* aOriginalElement,
|
||||
nsAString& aStr) { return true; };
|
||||
@@ -299,17 +297,14 @@ class nsXMLContentSerializer : public nsIContentSerializer {
|
||||
* add intendation. Call only in the case of formating and if the current
|
||||
* position is at 0. It updates the column position.
|
||||
*/
|
||||
MOZ_MUST_USE
|
||||
bool AppendIndentation(nsAString& aStr);
|
||||
[[nodiscard]] bool AppendIndentation(nsAString& aStr);
|
||||
|
||||
MOZ_MUST_USE
|
||||
bool IncrIndentation(nsIAtom* aName);
|
||||
[[nodiscard]] bool IncrIndentation(nsIAtom* aName);
|
||||
void DecrIndentation(nsIAtom* aName);
|
||||
|
||||
// Functions to check for newlines that needs to be added between nodes in
|
||||
// the root of a document. See mAddNewlineForRootNode
|
||||
MOZ_MUST_USE
|
||||
bool MaybeAddNewlineForRootNode(nsAString& aStr);
|
||||
[[nodiscard]] bool MaybeAddNewlineForRootNode(nsAString& aStr);
|
||||
void MaybeFlagNewlineForRootNode(nsINode* aNode);
|
||||
|
||||
// Functions to check if we enter in or leave from a preformated content
|
||||
|
||||
+23
-23
@@ -24,7 +24,7 @@ class Promise;
|
||||
// JSContext.
|
||||
|
||||
// Accept strings.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const nsAString& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
@@ -35,7 +35,7 @@ ToJSValue(JSContext* aCx,
|
||||
// desirable. So make this a template that only gets used if the argument type
|
||||
// is actually boolean
|
||||
template<typename T>
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
typename EnableIf<IsSame<T, bool>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
T aArgument,
|
||||
@@ -123,7 +123,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
// Accept CallbackObjects
|
||||
MOZ_MUST_USE inline bool
|
||||
[[nodiscard]] inline bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
CallbackObject& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@@ -139,7 +139,7 @@ ToJSValue(JSContext* aCx,
|
||||
// Accept objects that inherit from nsWrapperCache (e.g. most
|
||||
// DOM objects).
|
||||
template <class T>
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
T& aArgument,
|
||||
@@ -155,7 +155,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept typed arrays built from appropriate nsTArray values
|
||||
template<typename T>
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
const TypedArrayCreator<T>& aArgument,
|
||||
@@ -175,7 +175,7 @@ ToJSValue(JSContext* aCx,
|
||||
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
|
||||
// DOM File).
|
||||
template <class T>
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
|
||||
!IsBaseOf<CallbackObject, T>::value &&
|
||||
IsBaseOf<nsISupports, T>::value, bool>::Type
|
||||
@@ -193,7 +193,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept nsRefPtr/nsCOMPtr
|
||||
template <typename T>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const nsCOMPtr<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@@ -202,7 +202,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const RefPtr<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@@ -211,7 +211,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const NonNull<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@@ -221,7 +221,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept WebIDL dictionaries
|
||||
template <class T>
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
const T& aArgument,
|
||||
@@ -231,7 +231,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
// Accept existing JS values (which may not be same-compartment with us
|
||||
MOZ_MUST_USE inline bool
|
||||
[[nodiscard]] inline bool
|
||||
ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
|
||||
}
|
||||
|
||||
// Accept existing JS values on the Heap (which may not be same-compartment with us
|
||||
MOZ_MUST_USE inline bool
|
||||
[[nodiscard]] inline bool
|
||||
ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
|
||||
}
|
||||
|
||||
// Accept existing rooted JS values (which may not be same-compartment with us
|
||||
MOZ_MUST_USE inline bool
|
||||
[[nodiscard]] inline bool
|
||||
ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
@@ -259,7 +259,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
|
||||
|
||||
// Accept existing rooted JS objects (which may not be same-compartment with
|
||||
// us).
|
||||
MOZ_MUST_USE inline bool
|
||||
[[nodiscard]] inline bool
|
||||
ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
@@ -269,7 +269,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
|
||||
|
||||
// Accept nsresult, for use in rejections, and create an XPCOM
|
||||
// exception object representing that nsresult.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
nsresult aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
@@ -277,14 +277,14 @@ ToJSValue(JSContext* aCx,
|
||||
// Accept ErrorResult, for use in rejections, and create an exception
|
||||
// representing the failure. Note, the ErrorResult must indicate a failure
|
||||
// with aArgument.Failure() returning true.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
ErrorResult& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
|
||||
// Accept owning WebIDL unions.
|
||||
template <typename T>
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
typename EnableIf<IsBaseOf<AllOwningUnionBase, T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
const T& aArgument,
|
||||
@@ -296,7 +296,7 @@ ToJSValue(JSContext* aCx,
|
||||
|
||||
// Accept pointers to other things we accept
|
||||
template <typename T>
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
typename EnableIf<IsPointer<T>::value, bool>::Type
|
||||
ToJSValue(JSContext* aCx,
|
||||
T aArgument,
|
||||
@@ -306,14 +306,14 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
// Accept Promise objects, which need special handling.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
Promise& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
|
||||
// Accept arrays of other things we accept
|
||||
template <typename T>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
T* aArguments,
|
||||
size_t aLength,
|
||||
@@ -340,7 +340,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const nsTArray<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@@ -350,7 +350,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const FallibleTArray<T>& aArgument,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
@@ -360,7 +360,7 @@ ToJSValue(JSContext* aCx,
|
||||
}
|
||||
|
||||
template <typename T, int N>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ToJSValue(JSContext* aCx,
|
||||
const T(&aArgument)[N],
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
// Whether the value change should be notified to the frame/contet nor not.
|
||||
eSetValue_Notify = 1 << 2
|
||||
};
|
||||
MOZ_MUST_USE bool SetValue(const nsAString& aValue, uint32_t aFlags);
|
||||
[[nodiscard]] bool SetValue(const nsAString& aValue, uint32_t aFlags);
|
||||
void GetValue(nsAString& aValue, bool aIgnoreWrap) const;
|
||||
bool HasNonEmptyValue();
|
||||
// The following methods are for textarea element to use whether default
|
||||
|
||||
@@ -63,11 +63,11 @@ public:
|
||||
virtual bool IsForApp() const = 0;
|
||||
virtual bool IsForBrowser() const = 0;
|
||||
|
||||
MOZ_MUST_USE virtual PBlobParent*
|
||||
[[nodiscard]] virtual PBlobParent*
|
||||
SendPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams) = 0;
|
||||
|
||||
MOZ_MUST_USE virtual PBrowserParent*
|
||||
[[nodiscard]] virtual PBrowserParent*
|
||||
SendPBrowserConstructor(PBrowserParent* actor,
|
||||
const TabId& aTabId,
|
||||
const IPCTabContext& context,
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
base_type::SetLength(newLen + sExtra);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool SetLength(size_type newLen, const mozilla::fallible_t&)
|
||||
{
|
||||
return base_type::SetLength(newLen + sExtra, mozilla::fallible);
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
base_type::SetLength(newLen + sExtra);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
bool SetLength(size_type newLen, const mozilla::fallible_t&)
|
||||
{
|
||||
return base_type::SetLength(newLen + sExtra, mozilla::fallible);
|
||||
|
||||
@@ -2210,7 +2210,10 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
|
||||
if (supportsAsyncRender) {
|
||||
// Prefs indicates we want async plugin rendering, make sure
|
||||
// the flash module has support.
|
||||
CallModuleSupportsAsyncRender(&supportsAsyncRender);
|
||||
if (!CallModuleSupportsAsyncRender(&supportsAsyncRender)) {
|
||||
// The actual support call failed. Should not happen; abort.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
#ifdef _WIN64
|
||||
// For 64-bit builds force windowless if the flash library doesn't support
|
||||
|
||||
@@ -34,7 +34,9 @@ public:
|
||||
|
||||
for (auto iter = mAudioNotificationSet->ConstIter(); !iter.Done(); iter.Next()) {
|
||||
PluginModuleParent* pluginModule = iter.Get()->GetKey();
|
||||
pluginModule->SendNPP_SetValue_NPNVaudioDeviceChangeDetails(mChangeDetails);
|
||||
if (!pluginModule->SendNPP_SetValue_NPNVaudioDeviceChangeDetails(mChangeDetails)) {
|
||||
// Sending of notification failed. Ignore for now.
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -287,14 +287,14 @@ public:
|
||||
insertBack(aElem);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
already_AddRefed<ScriptLoadRequest> Steal(ScriptLoadRequest* aElem)
|
||||
{
|
||||
aElem->removeFrom(*this);
|
||||
return dont_AddRef(aElem);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE
|
||||
[[nodiscard]]
|
||||
already_AddRefed<ScriptLoadRequest> StealFirst()
|
||||
{
|
||||
MOZ_ASSERT(!isEmpty());
|
||||
|
||||
+10
-10
@@ -224,11 +224,11 @@ public:
|
||||
// If aGlobalObject represents a web-visible global, errors reported by this
|
||||
// AutoJSAPI as it comes off the stack will fire the relevant error events and
|
||||
// show up in the corresponding web console.
|
||||
MOZ_MUST_USE bool Init(nsIGlobalObject* aGlobalObject);
|
||||
[[nodiscard]] bool Init(nsIGlobalObject* aGlobalObject);
|
||||
|
||||
// This is a helper that grabs the native global associated with aObject and
|
||||
// invokes the above Init() with that.
|
||||
MOZ_MUST_USE bool Init(JSObject* aObject);
|
||||
[[nodiscard]] bool Init(JSObject* aObject);
|
||||
|
||||
// Unsurprisingly, this uses aCx and enters the compartment of aGlobalObject.
|
||||
// If aGlobalObject or its associated JS global are null then it returns
|
||||
@@ -238,15 +238,15 @@ public:
|
||||
// If aGlobalObject represents a web-visible global, errors reported by this
|
||||
// AutoJSAPI as it comes off the stack will fire the relevant error events and
|
||||
// show up in the corresponding web console.
|
||||
MOZ_MUST_USE bool Init(nsIGlobalObject* aGlobalObject, JSContext* aCx);
|
||||
[[nodiscard]] bool Init(nsIGlobalObject* aGlobalObject, JSContext* aCx);
|
||||
|
||||
// Convenience functions to take an nsPIDOMWindow* or nsGlobalWindow*,
|
||||
// when it is more easily available than an nsIGlobalObject.
|
||||
MOZ_MUST_USE bool Init(nsPIDOMWindowInner* aWindow);
|
||||
MOZ_MUST_USE bool Init(nsPIDOMWindowInner* aWindow, JSContext* aCx);
|
||||
[[nodiscard]] bool Init(nsPIDOMWindowInner* aWindow);
|
||||
[[nodiscard]] bool Init(nsPIDOMWindowInner* aWindow, JSContext* aCx);
|
||||
|
||||
MOZ_MUST_USE bool Init(nsGlobalWindow* aWindow);
|
||||
MOZ_MUST_USE bool Init(nsGlobalWindow* aWindow, JSContext* aCx);
|
||||
[[nodiscard]] bool Init(nsGlobalWindow* aWindow);
|
||||
[[nodiscard]] bool Init(nsGlobalWindow* aWindow, JSContext* aCx);
|
||||
|
||||
JSContext* cx() const {
|
||||
MOZ_ASSERT(mCx, "Must call Init before using an AutoJSAPI");
|
||||
@@ -272,12 +272,12 @@ public:
|
||||
//
|
||||
// Note that this fails if and only if we OOM while wrapping the exception
|
||||
// into the current compartment.
|
||||
MOZ_MUST_USE bool StealException(JS::MutableHandle<JS::Value> aVal);
|
||||
[[nodiscard]] bool StealException(JS::MutableHandle<JS::Value> aVal);
|
||||
|
||||
// As for StealException(), but put the saved frames for any stack trace
|
||||
// associated with the point the exception was thrown into aStack.
|
||||
// aVal will be in the current compartment, but aStack might not be.
|
||||
MOZ_MUST_USE bool StealExceptionAndStack(JS::MutableHandle<JS::Value> aVal,
|
||||
[[nodiscard]] bool StealExceptionAndStack(JS::MutableHandle<JS::Value> aVal,
|
||||
JS::MutableHandle<JSObject*> aStack);
|
||||
|
||||
// Peek the current exception from the JS engine, without stealing it.
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
//
|
||||
// Note that this fails if and only if we OOM while wrapping the exception
|
||||
// into the current compartment.
|
||||
MOZ_MUST_USE bool PeekException(JS::MutableHandle<JS::Value> aVal);
|
||||
[[nodiscard]] bool PeekException(JS::MutableHandle<JS::Value> aVal);
|
||||
|
||||
void ClearException() {
|
||||
MOZ_ASSERT(IsStackTop());
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
// This method should be called only when the string is really needed because
|
||||
// it can cause the duplication of the strings in case the loading of the XHR
|
||||
// is not completed yet.
|
||||
MOZ_MUST_USE bool GetAsString(nsAString& aString) const;
|
||||
[[nodiscard]] bool GetAsString(nsAString& aString) const;
|
||||
|
||||
size_t SizeOfThis(MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
return !mLength;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool GetAsString(DOMString& aString) const;
|
||||
[[nodiscard]] bool GetAsString(DOMString& aString) const;
|
||||
|
||||
private:
|
||||
XMLHttpRequestStringSnapshot(const XMLHttpRequestStringSnapshot&) = delete;
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
mData.Append(aString);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
GetAsString(nsAString& aString)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
return mData.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
GetAsString(DOMString& aString, uint32_t aLength)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
{
|
||||
}
|
||||
~txLoadedDocumentsHash();
|
||||
MOZ_MUST_USE nsresult init(const txXPathNode& aSource);
|
||||
[[nodiscard]] nsresult init(const txXPathNode& aSource);
|
||||
|
||||
private:
|
||||
friend class txExecutionState;
|
||||
|
||||
+6
-6
@@ -111,7 +111,7 @@ struct BaseRect {
|
||||
// Intersection with an empty Rect may not produce an empty Rect if overflow
|
||||
// occurs. e.g. {INT_MIN, 0, 0, 20} Intersect { 5000, 0, 500, 20 } gives:
|
||||
// the non-emtpy {5000, 0, 500, 20 } instead of {5000, 0, 0, 0}
|
||||
MOZ_MUST_USE Sub Intersect(const Sub& aRect) const
|
||||
[[nodiscard]] Sub Intersect(const Sub& aRect) const
|
||||
{
|
||||
Sub result;
|
||||
result.x = std::max<T>(x, aRect.x);
|
||||
@@ -127,7 +127,7 @@ struct BaseRect {
|
||||
// better. This comes at a tiny cost in performance.
|
||||
// e.g. {INT_MIN, 0, 0, 20} Intersect { 5000, 0, 500, 20 } gives:
|
||||
// {5000, 0, 0, 0}
|
||||
MOZ_MUST_USE Sub SafeIntersect(const Sub& aRect) const
|
||||
[[nodiscard]] Sub SafeIntersect(const Sub& aRect) const
|
||||
{
|
||||
Sub result;
|
||||
result.x = std::max<T>(x, aRect.x);
|
||||
@@ -161,7 +161,7 @@ struct BaseRect {
|
||||
// If both rectangles are empty, returns this.
|
||||
// WARNING! This is not safe against overflow, prefer using SafeUnion instead
|
||||
// when dealing with int-based rects.
|
||||
MOZ_MUST_USE Sub Union(const Sub& aRect) const
|
||||
[[nodiscard]] Sub Union(const Sub& aRect) const
|
||||
{
|
||||
if (IsEmpty()) {
|
||||
return aRect;
|
||||
@@ -176,7 +176,7 @@ struct BaseRect {
|
||||
// Thus, empty input rectangles are allowed to affect the result.
|
||||
// WARNING! This is not safe against overflow, prefer using SafeUnionEdges
|
||||
// instead when dealing with int-based rects.
|
||||
MOZ_MUST_USE Sub UnionEdges(const Sub& aRect) const
|
||||
[[nodiscard]] Sub UnionEdges(const Sub& aRect) const
|
||||
{
|
||||
Sub result;
|
||||
result.x = std::min(x, aRect.x);
|
||||
@@ -588,7 +588,7 @@ struct BaseRect {
|
||||
* Clamp aPoint to this rectangle. It is allowed to end up on any
|
||||
* edge of the rectangle.
|
||||
*/
|
||||
MOZ_MUST_USE Point ClampPoint(const Point& aPoint) const
|
||||
[[nodiscard]] Point ClampPoint(const Point& aPoint) const
|
||||
{
|
||||
return Point(std::max(x, std::min(XMost(), aPoint.x)),
|
||||
std::max(y, std::min(YMost(), aPoint.y)));
|
||||
@@ -599,7 +599,7 @@ struct BaseRect {
|
||||
* aRect then the dimensions that don't fit will be shrunk so that they
|
||||
* do fit. The resulting rect is returned.
|
||||
*/
|
||||
MOZ_MUST_USE Sub MoveInsideAndClamp(const Sub& aRect) const
|
||||
[[nodiscard]] Sub MoveInsideAndClamp(const Sub& aRect) const
|
||||
{
|
||||
Sub rect(std::max(aRect.x, x),
|
||||
std::max(aRect.y, y),
|
||||
|
||||
+2
-2
@@ -166,7 +166,7 @@ struct IntRectTyped :
|
||||
// Same as Union(), but in the cases where aRect is non-empty, the union is
|
||||
// done while guarding against overflow. If an overflow is detected, Nothing
|
||||
// is returned.
|
||||
MOZ_MUST_USE Maybe<Self> SafeUnion(const Self& aRect) const
|
||||
[[nodiscard]] Maybe<Self> SafeUnion(const Self& aRect) const
|
||||
{
|
||||
if (this->IsEmpty()) {
|
||||
return aRect.Overflows() ? Nothing() : Some(aRect);
|
||||
@@ -179,7 +179,7 @@ struct IntRectTyped :
|
||||
|
||||
// Same as UnionEdges, but guards against overflow. If an overflow is detected,
|
||||
// Nothing is returned.
|
||||
MOZ_MUST_USE Maybe<Self> SafeUnionEdges(const Self& aRect) const
|
||||
[[nodiscard]] Maybe<Self> SafeUnionEdges(const Self& aRect) const
|
||||
{
|
||||
if (this->Overflows() || aRect.Overflows()) {
|
||||
return Nothing();
|
||||
|
||||
@@ -823,9 +823,9 @@ extern int pplex \
|
||||
*/
|
||||
YY_DECL
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
yy_state_type yy_current_state;
|
||||
char *yy_cp, *yy_bp;
|
||||
int yy_act;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
yylval = yylval_param;
|
||||
@@ -878,7 +878,7 @@ YY_DECL
|
||||
yy_match:
|
||||
do
|
||||
{
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
|
||||
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
yyg->yy_last_accepting_state = yy_current_state;
|
||||
@@ -1336,9 +1336,9 @@ ECHO;
|
||||
static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
||||
register char *source = yyg->yytext_ptr;
|
||||
register int number_to_move, i;
|
||||
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
||||
char *source = yyg->yytext_ptr;
|
||||
int number_to_move, i;
|
||||
int ret_val;
|
||||
|
||||
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
|
||||
@@ -1470,15 +1470,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp;
|
||||
yy_state_type yy_current_state;
|
||||
char *yy_cp;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
yy_current_state = yyg->yy_start;
|
||||
|
||||
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
|
||||
{
|
||||
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
||||
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
yyg->yy_last_accepting_state = yy_current_state;
|
||||
@@ -1503,11 +1503,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
*/
|
||||
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
|
||||
{
|
||||
register int yy_is_jam;
|
||||
int yy_is_jam;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
|
||||
register char *yy_cp = yyg->yy_c_buf_p;
|
||||
char *yy_cp = yyg->yy_c_buf_p;
|
||||
|
||||
register YY_CHAR yy_c = 1;
|
||||
YY_CHAR yy_c = 1;
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
yyg->yy_last_accepting_state = yy_current_state;
|
||||
|
||||
@@ -1286,9 +1286,9 @@ extern int yylex \
|
||||
*/
|
||||
YY_DECL
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
yy_state_type yy_current_state;
|
||||
char *yy_cp, *yy_bp;
|
||||
int yy_act;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
yylval = yylval_param;
|
||||
@@ -1341,7 +1341,7 @@ YY_DECL
|
||||
yy_match:
|
||||
do
|
||||
{
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
|
||||
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
yyg->yy_last_accepting_state = yy_current_state;
|
||||
@@ -2237,9 +2237,9 @@ ECHO;
|
||||
static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
||||
register char *source = yyg->yytext_ptr;
|
||||
register int number_to_move, i;
|
||||
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
||||
char *source = yyg->yytext_ptr;
|
||||
int number_to_move, i;
|
||||
int ret_val;
|
||||
|
||||
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
|
||||
@@ -2371,15 +2371,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
|
||||
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp;
|
||||
yy_state_type yy_current_state;
|
||||
char *yy_cp;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
yy_current_state = yyg->yy_start;
|
||||
|
||||
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
|
||||
{
|
||||
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
||||
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
yyg->yy_last_accepting_state = yy_current_state;
|
||||
@@ -2404,11 +2404,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
*/
|
||||
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
|
||||
{
|
||||
register int yy_is_jam;
|
||||
int yy_is_jam;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
|
||||
register char *yy_cp = yyg->yy_c_buf_p;
|
||||
char *yy_cp = yyg->yy_c_buf_p;
|
||||
|
||||
register YY_CHAR yy_c = 1;
|
||||
YY_CHAR yy_c = 1;
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
yyg->yy_last_accepting_state = yy_current_state;
|
||||
|
||||
+3
-3
@@ -35,12 +35,12 @@ struct nsPoint : public mozilla::gfx::BasePoint<nscoord, nsPoint> {
|
||||
* @param aFromAPP the APP to scale from
|
||||
* @param aToAPP the APP to scale to
|
||||
*/
|
||||
MOZ_MUST_USE inline nsPoint
|
||||
[[nodiscard]] inline nsPoint
|
||||
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
|
||||
|
||||
MOZ_MUST_USE inline nsPoint
|
||||
[[nodiscard]] inline nsPoint
|
||||
RemoveResolution(const float resolution) const;
|
||||
MOZ_MUST_USE inline nsPoint
|
||||
[[nodiscard]] inline nsPoint
|
||||
ApplyResolution(const float resolution) const;
|
||||
};
|
||||
|
||||
|
||||
+13
-13
@@ -56,7 +56,7 @@ struct nsRect :
|
||||
// overflowing nscoord values in the 'width' and 'height' fields by
|
||||
// clamping the width and height values to nscoord_MAX if necessary.
|
||||
|
||||
MOZ_MUST_USE nsRect SaturatingUnion(const nsRect& aRect) const
|
||||
[[nodiscard]] nsRect SaturatingUnion(const nsRect& aRect) const
|
||||
{
|
||||
if (IsEmpty()) {
|
||||
return aRect;
|
||||
@@ -67,7 +67,7 @@ struct nsRect :
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_MUST_USE nsRect SaturatingUnionEdges(const nsRect& aRect) const
|
||||
[[nodiscard]] nsRect SaturatingUnionEdges(const nsRect& aRect) const
|
||||
{
|
||||
#ifdef NS_COORD_IS_FLOAT
|
||||
return UnionEdges(aRect);
|
||||
@@ -102,7 +102,7 @@ struct nsRect :
|
||||
|
||||
#ifndef NS_COORD_IS_FLOAT
|
||||
// Make all nsRect Union methods be saturating.
|
||||
MOZ_MUST_USE nsRect UnionEdges(const nsRect& aRect) const
|
||||
[[nodiscard]] nsRect UnionEdges(const nsRect& aRect) const
|
||||
{
|
||||
return SaturatingUnionEdges(aRect);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ struct nsRect :
|
||||
{
|
||||
*this = aRect1.UnionEdges(aRect2);
|
||||
}
|
||||
MOZ_MUST_USE nsRect Union(const nsRect& aRect) const
|
||||
[[nodiscard]] nsRect Union(const nsRect& aRect) const
|
||||
{
|
||||
return SaturatingUnion(aRect);
|
||||
}
|
||||
@@ -141,32 +141,32 @@ struct nsRect :
|
||||
* @param aToAPP the APP to scale to
|
||||
* @note this can turn an empty rectangle into a non-empty rectangle
|
||||
*/
|
||||
MOZ_MUST_USE inline nsRect
|
||||
[[nodiscard]] inline nsRect
|
||||
ScaleToOtherAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const;
|
||||
MOZ_MUST_USE inline nsRect
|
||||
[[nodiscard]] inline nsRect
|
||||
ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const;
|
||||
|
||||
MOZ_MUST_USE inline mozilla::gfx::IntRect
|
||||
[[nodiscard]] inline mozilla::gfx::IntRect
|
||||
ScaleToNearestPixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
MOZ_MUST_USE inline mozilla::gfx::IntRect
|
||||
[[nodiscard]] inline mozilla::gfx::IntRect
|
||||
ToNearestPixels(nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
// Note: this can turn an empty rectangle into a non-empty rectangle
|
||||
MOZ_MUST_USE inline mozilla::gfx::IntRect
|
||||
[[nodiscard]] inline mozilla::gfx::IntRect
|
||||
ScaleToOutsidePixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
// Note: this can turn an empty rectangle into a non-empty rectangle
|
||||
MOZ_MUST_USE inline mozilla::gfx::IntRect
|
||||
[[nodiscard]] inline mozilla::gfx::IntRect
|
||||
ToOutsidePixels(nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
MOZ_MUST_USE inline mozilla::gfx::IntRect
|
||||
[[nodiscard]] inline mozilla::gfx::IntRect
|
||||
ScaleToInsidePixels(float aXScale, float aYScale,
|
||||
nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
MOZ_MUST_USE inline mozilla::gfx::IntRect
|
||||
[[nodiscard]] inline mozilla::gfx::IntRect
|
||||
ToInsidePixels(nscoord aAppUnitsPerPixel) const;
|
||||
|
||||
// This is here only to keep IPDL-generated code happy. DO NOT USE.
|
||||
@@ -175,7 +175,7 @@ struct nsRect :
|
||||
return IsEqualEdges(aRect);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE inline nsRect RemoveResolution(const float aResolution) const;
|
||||
[[nodiscard]] inline nsRect RemoveResolution(const float aResolution) const;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -296,9 +296,9 @@ public:
|
||||
* @param aToAPP the APP to scale to
|
||||
* @note this can turn an empty region into a non-empty region
|
||||
*/
|
||||
MOZ_MUST_USE nsRegion
|
||||
[[nodiscard]] nsRegion
|
||||
ScaleToOtherAppUnitsRoundOut (int32_t aFromAPP, int32_t aToAPP) const;
|
||||
MOZ_MUST_USE nsRegion
|
||||
[[nodiscard]] nsRegion
|
||||
ScaleToOtherAppUnitsRoundIn (int32_t aFromAPP, int32_t aToAPP) const;
|
||||
nsRegion& ScaleRoundOut(float aXScale, float aYScale);
|
||||
nsRegion& ScaleInverseRoundOut(float aXScale, float aYScale);
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ struct nsSize : public mozilla::gfx::BaseSize<nscoord, nsSize> {
|
||||
* @param aFromAPP the APP to scale from
|
||||
* @param aToAPP the APP to scale to
|
||||
*/
|
||||
MOZ_MUST_USE inline nsSize
|
||||
[[nodiscard]] inline nsSize
|
||||
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConf
|
||||
* Lock the screen orientation to the specific orientation.
|
||||
* @return Whether the lock has been accepted.
|
||||
*/
|
||||
MOZ_MUST_USE bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
|
||||
[[nodiscard]] bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
|
||||
|
||||
/**
|
||||
* Unlock the screen orientation.
|
||||
@@ -346,7 +346,7 @@ void UnlockScreenOrientation();
|
||||
*
|
||||
* Currently, there can only be 0 or 1 alarm observers.
|
||||
*/
|
||||
MOZ_MUST_USE bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
|
||||
[[nodiscard]] bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
|
||||
|
||||
/**
|
||||
* Unregister the alarm observer. Doing so will implicitly cancel any
|
||||
@@ -373,7 +373,7 @@ void NotifyAlarmFired();
|
||||
* This API is currently only allowed to be used from non-sandboxed
|
||||
* contexts.
|
||||
*/
|
||||
MOZ_MUST_USE bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
|
||||
[[nodiscard]] bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
|
||||
|
||||
/**
|
||||
* Set the priority of the given process.
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ void DisableScreenConfigurationNotifications();
|
||||
/**
|
||||
* Enable alarm notifications from the backend.
|
||||
*/
|
||||
MOZ_MUST_USE bool EnableAlarm();
|
||||
[[nodiscard]] bool EnableAlarm();
|
||||
|
||||
/**
|
||||
* Disable alarm notifications from the backend.
|
||||
|
||||
+15
-15
@@ -287,22 +287,22 @@ public:
|
||||
imgLoader();
|
||||
nsresult Init();
|
||||
|
||||
MOZ_MUST_USE nsresult LoadImage(nsIURI* aURI,
|
||||
nsIURI* aInitialDocumentURI,
|
||||
nsIURI* aReferrerURI,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
nsIPrincipal* aLoadingPrincipal,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
imgINotificationObserver* aObserver,
|
||||
nsINode* aContext,
|
||||
nsIDocument* aLoadingDocument,
|
||||
nsLoadFlags aLoadFlags,
|
||||
nsISupports* aCacheKey,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
const nsAString& initiatorType,
|
||||
imgRequestProxy** _retval);
|
||||
[[nodiscard]] nsresult LoadImage(nsIURI* aURI,
|
||||
nsIURI* aInitialDocumentURI,
|
||||
nsIURI* aReferrerURI,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
nsIPrincipal* aLoadingPrincipal,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
imgINotificationObserver* aObserver,
|
||||
nsINode* aContext,
|
||||
nsIDocument* aLoadingDocument,
|
||||
nsLoadFlags aLoadFlags,
|
||||
nsISupports* aCacheKey,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
const nsAString& initiatorType,
|
||||
imgRequestProxy** _retval);
|
||||
|
||||
MOZ_MUST_USE nsresult
|
||||
[[nodiscard]] nsresult
|
||||
LoadImageWithChannel(nsIChannel* channel,
|
||||
imgINotificationObserver* aObserver,
|
||||
nsISupports* aCX,
|
||||
|
||||
+10
-10
@@ -65,16 +65,16 @@ public:
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
|
||||
|
||||
MOZ_MUST_USE nsresult Init(nsIURI* aURI,
|
||||
nsIURI* aCurrentURI,
|
||||
bool aHadInsecureRedirect,
|
||||
nsIRequest* aRequest,
|
||||
nsIChannel* aChannel,
|
||||
imgCacheEntry* aCacheEntry,
|
||||
nsISupports* aCX,
|
||||
nsIPrincipal* aLoadingPrincipal,
|
||||
int32_t aCORSMode,
|
||||
ReferrerPolicy aReferrerPolicy);
|
||||
[[nodiscard]] nsresult Init(nsIURI* aURI,
|
||||
nsIURI* aCurrentURI,
|
||||
bool aHadInsecureRedirect,
|
||||
nsIRequest* aRequest,
|
||||
nsIChannel* aChannel,
|
||||
imgCacheEntry* aCacheEntry,
|
||||
nsISupports* aCX,
|
||||
nsIPrincipal* aLoadingPrincipal,
|
||||
int32_t aCORSMode,
|
||||
ReferrerPolicy aReferrerPolicy);
|
||||
|
||||
void ClearLoader();
|
||||
|
||||
|
||||
@@ -110,9 +110,9 @@ public:
|
||||
* NS_ERROR_OUT_OF_MEMORY if OOM
|
||||
* NS_OK is all we have is an approximation
|
||||
*/
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) = 0;
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Resets the charset converter so it may be recycled for a completely
|
||||
|
||||
@@ -135,9 +135,9 @@ public:
|
||||
* NS_ERROR_OUT_OF_MEMORY if OOM
|
||||
* NS_OK if all we have is an approximation
|
||||
*/
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) = 0;
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Resets the charset converter so it may be recycled for a completely
|
||||
|
||||
@@ -24,9 +24,9 @@ public:
|
||||
char16_t* aDest,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
NS_IMETHOD Reset() override;
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ protected:
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsDecoderSupport class [declaration]
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [declaration]
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
|
||||
NS_IMETHOD Finish(char* aDest, int32_t* aDestLength) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
NS_IMETHOD Reset() override {mHighSurrogate = 0; return NS_OK;}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ public:
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsDecoderSupport class [declaration]
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
NS_IMETHOD Reset() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -19,9 +19,9 @@ public:
|
||||
|
||||
NS_IMETHOD Convert(const char16_t* aSrc, int32_t* aSrcLength,
|
||||
char* aDest, int32_t* aDestLength);
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength);
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength);
|
||||
NS_IMETHOD Finish(char* aDest, int32_t* aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior,
|
||||
|
||||
@@ -29,9 +29,9 @@ public:
|
||||
NS_IMETHOD Finish(char* aDest,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
NS_IMETHOD Reset() override;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2023, Moonchild Productions.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
@@ -92,32 +93,32 @@ class Pickle {
|
||||
// the Pickle, initialize *iter to NULL. If successful, these methods return
|
||||
// true. Otherwise, false is returned to indicate that the result could not
|
||||
// be extracted.
|
||||
MOZ_MUST_USE bool ReadBool(PickleIterator* iter, bool* result) const;
|
||||
MOZ_MUST_USE bool ReadInt16(PickleIterator* iter, int16_t* result) const;
|
||||
MOZ_MUST_USE bool ReadUInt16(PickleIterator* iter, uint16_t* result) const;
|
||||
MOZ_MUST_USE bool ReadShort(PickleIterator* iter, short* result) const;
|
||||
MOZ_MUST_USE bool ReadInt(PickleIterator* iter, int* result) const;
|
||||
MOZ_MUST_USE bool ReadLong(PickleIterator* iter, long* result) const;
|
||||
MOZ_MUST_USE bool ReadULong(PickleIterator* iter, unsigned long* result) const;
|
||||
MOZ_MUST_USE bool ReadSize(PickleIterator* iter, size_t* result) const;
|
||||
MOZ_MUST_USE bool ReadInt32(PickleIterator* iter, int32_t* result) const;
|
||||
MOZ_MUST_USE bool ReadUInt32(PickleIterator* iter, uint32_t* result) const;
|
||||
MOZ_MUST_USE bool ReadInt64(PickleIterator* iter, int64_t* result) const;
|
||||
MOZ_MUST_USE bool ReadUInt64(PickleIterator* iter, uint64_t* result) const;
|
||||
MOZ_MUST_USE bool ReadDouble(PickleIterator* iter, double* result) const;
|
||||
MOZ_MUST_USE bool ReadIntPtr(PickleIterator* iter, intptr_t* result) const;
|
||||
MOZ_MUST_USE bool ReadUnsignedChar(PickleIterator* iter, unsigned char* result) const;
|
||||
MOZ_MUST_USE bool ReadString(PickleIterator* iter, std::string* result) const;
|
||||
MOZ_MUST_USE bool ReadWString(PickleIterator* iter, std::wstring* result) const;
|
||||
MOZ_MUST_USE bool ReadBytesInto(PickleIterator* iter, void* data, uint32_t length) const;
|
||||
MOZ_MUST_USE bool ExtractBuffers(PickleIterator* iter, size_t length, BufferList* buffers,
|
||||
uint32_t alignment = sizeof(memberAlignmentType)) const;
|
||||
[[nodiscard]] bool ReadBool(PickleIterator* iter, bool* result) const;
|
||||
[[nodiscard]] bool ReadInt16(PickleIterator* iter, int16_t* result) const;
|
||||
[[nodiscard]] bool ReadUInt16(PickleIterator* iter, uint16_t* result) const;
|
||||
[[nodiscard]] bool ReadShort(PickleIterator* iter, short* result) const;
|
||||
[[nodiscard]] bool ReadInt(PickleIterator* iter, int* result) const;
|
||||
[[nodiscard]] bool ReadLong(PickleIterator* iter, long* result) const;
|
||||
[[nodiscard]] bool ReadULong(PickleIterator* iter, unsigned long* result) const;
|
||||
[[nodiscard]] bool ReadSize(PickleIterator* iter, size_t* result) const;
|
||||
[[nodiscard]] bool ReadInt32(PickleIterator* iter, int32_t* result) const;
|
||||
[[nodiscard]] bool ReadUInt32(PickleIterator* iter, uint32_t* result) const;
|
||||
[[nodiscard]] bool ReadInt64(PickleIterator* iter, int64_t* result) const;
|
||||
[[nodiscard]] bool ReadUInt64(PickleIterator* iter, uint64_t* result) const;
|
||||
[[nodiscard]] bool ReadDouble(PickleIterator* iter, double* result) const;
|
||||
[[nodiscard]] bool ReadIntPtr(PickleIterator* iter, intptr_t* result) const;
|
||||
[[nodiscard]] bool ReadUnsignedChar(PickleIterator* iter, unsigned char* result) const;
|
||||
[[nodiscard]] bool ReadString(PickleIterator* iter, std::string* result) const;
|
||||
[[nodiscard]] bool ReadWString(PickleIterator* iter, std::wstring* result) const;
|
||||
[[nodiscard]] bool ReadBytesInto(PickleIterator* iter, void* data, uint32_t length) const;
|
||||
[[nodiscard]] bool ExtractBuffers(PickleIterator* iter, size_t length, BufferList* buffers,
|
||||
uint32_t alignment = sizeof(memberAlignmentType)) const;
|
||||
|
||||
// Safer version of ReadInt() checks for the result not being negative.
|
||||
// Use it for reading the object sizes.
|
||||
MOZ_MUST_USE bool ReadLength(PickleIterator* iter, int* result) const;
|
||||
[[nodiscard]] bool ReadLength(PickleIterator* iter, int* result) const;
|
||||
|
||||
MOZ_MUST_USE bool ReadSentinel(PickleIterator* iter, uint32_t sentinel) const
|
||||
[[nodiscard]] bool ReadSentinel(PickleIterator* iter, uint32_t sentinel) const
|
||||
#ifdef MOZ_PICKLE_SENTINEL_CHECKING
|
||||
;
|
||||
#else
|
||||
|
||||
@@ -185,7 +185,7 @@ class CxxCodeGen(CodePrinter, Visitor):
|
||||
self.printdent()
|
||||
|
||||
if md.warn_unused:
|
||||
self.write('MOZ_MUST_USE ')
|
||||
self.write('[[nodiscard]] ')
|
||||
if md.inline:
|
||||
self.write('inline ')
|
||||
if md.never_inline:
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
return mPtr.get();
|
||||
}
|
||||
|
||||
MOZ_MUST_USE Interface* Release()
|
||||
[[nodiscard]] Interface* Release()
|
||||
{
|
||||
return mPtr.release();
|
||||
}
|
||||
|
||||
+16
-16
@@ -88,7 +88,7 @@ class HashMap
|
||||
// HashMap construction is fallible (due to OOM); thus the user must call
|
||||
// init after constructing a HashMap and check the return value.
|
||||
explicit HashMap(AllocPolicy a = AllocPolicy()) : impl(a) {}
|
||||
MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); }
|
||||
[[nodiscard]] bool init(uint32_t len = 16) { return impl.init(len); }
|
||||
bool initialized() const { return impl.initialized(); }
|
||||
|
||||
// Return whether the given lookup value is present in the map. E.g.:
|
||||
@@ -151,19 +151,19 @@ class HashMap
|
||||
}
|
||||
|
||||
template<typename KeyInput, typename ValueInput>
|
||||
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) {
|
||||
[[nodiscard]] bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) {
|
||||
return impl.add(p,
|
||||
mozilla::Forward<KeyInput>(k),
|
||||
mozilla::Forward<ValueInput>(v));
|
||||
}
|
||||
|
||||
template<typename KeyInput>
|
||||
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k) {
|
||||
[[nodiscard]] bool add(AddPtr& p, KeyInput&& k) {
|
||||
return impl.add(p, mozilla::Forward<KeyInput>(k), Value());
|
||||
}
|
||||
|
||||
template<typename KeyInput, typename ValueInput>
|
||||
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) {
|
||||
[[nodiscard]] bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) {
|
||||
return impl.relookupOrAdd(p, k,
|
||||
mozilla::Forward<KeyInput>(k),
|
||||
mozilla::Forward<ValueInput>(v));
|
||||
@@ -232,7 +232,7 @@ class HashMap
|
||||
|
||||
// Overwrite existing value with v. Return false on oom.
|
||||
template<typename KeyInput, typename ValueInput>
|
||||
MOZ_MUST_USE bool put(KeyInput&& k, ValueInput&& v) {
|
||||
[[nodiscard]] bool put(KeyInput&& k, ValueInput&& v) {
|
||||
AddPtr p = lookupForAdd(k);
|
||||
if (p) {
|
||||
p->value() = mozilla::Forward<ValueInput>(v);
|
||||
@@ -243,7 +243,7 @@ class HashMap
|
||||
|
||||
// Like put, but assert that the given key is not already present.
|
||||
template<typename KeyInput, typename ValueInput>
|
||||
MOZ_MUST_USE bool putNew(KeyInput&& k, ValueInput&& v) {
|
||||
[[nodiscard]] bool putNew(KeyInput&& k, ValueInput&& v) {
|
||||
return impl.putNew(k, mozilla::Forward<KeyInput>(k), mozilla::Forward<ValueInput>(v));
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ class HashSet
|
||||
// HashSet construction is fallible (due to OOM); thus the user must call
|
||||
// init after constructing a HashSet and check the return value.
|
||||
explicit HashSet(AllocPolicy a = AllocPolicy()) : impl(a) {}
|
||||
MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); }
|
||||
[[nodiscard]] bool init(uint32_t len = 16) { return impl.init(len); }
|
||||
bool initialized() const { return impl.initialized(); }
|
||||
|
||||
// Return whether the given lookup value is present in the map. E.g.:
|
||||
@@ -399,12 +399,12 @@ class HashSet
|
||||
AddPtr lookupForAdd(const Lookup& l) const { return impl.lookupForAdd(l); }
|
||||
|
||||
template <typename U>
|
||||
MOZ_MUST_USE bool add(AddPtr& p, U&& u) {
|
||||
[[nodiscard]] bool add(AddPtr& p, U&& u) {
|
||||
return impl.add(p, mozilla::Forward<U>(u));
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) {
|
||||
[[nodiscard]] bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) {
|
||||
return impl.relookupOrAdd(p, l, mozilla::Forward<U>(u));
|
||||
}
|
||||
|
||||
@@ -471,19 +471,19 @@ class HashSet
|
||||
|
||||
// Add |u| if it is not present already. Return false on oom.
|
||||
template <typename U>
|
||||
MOZ_MUST_USE bool put(U&& u) {
|
||||
[[nodiscard]] bool put(U&& u) {
|
||||
AddPtr p = lookupForAdd(u);
|
||||
return p ? true : add(p, mozilla::Forward<U>(u));
|
||||
}
|
||||
|
||||
// Like put, but assert that the given key is not already present.
|
||||
template <typename U>
|
||||
MOZ_MUST_USE bool putNew(U&& u) {
|
||||
[[nodiscard]] bool putNew(U&& u) {
|
||||
return impl.putNew(u, mozilla::Forward<U>(u));
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
MOZ_MUST_USE bool putNew(const Lookup& l, U&& u) {
|
||||
[[nodiscard]] bool putNew(const Lookup& l, U&& u) {
|
||||
return impl.putNew(l, mozilla::Forward<U>(u));
|
||||
}
|
||||
|
||||
@@ -1277,7 +1277,7 @@ class HashTable : private AllocPolicy
|
||||
#endif
|
||||
{}
|
||||
|
||||
MOZ_MUST_USE bool init(uint32_t length)
|
||||
[[nodiscard]] bool init(uint32_t length)
|
||||
{
|
||||
MOZ_ASSERT(!initialized());
|
||||
|
||||
@@ -1775,7 +1775,7 @@ class HashTable : private AllocPolicy
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
MOZ_MUST_USE bool add(AddPtr& p, Args&&... args)
|
||||
[[nodiscard]] bool add(AddPtr& p, Args&&... args)
|
||||
{
|
||||
mozilla::ReentrancyGuard g(*this);
|
||||
MOZ_ASSERT(table);
|
||||
@@ -1828,7 +1828,7 @@ class HashTable : private AllocPolicy
|
||||
// Note: |l| may be alias arguments in |args|, so this function must take
|
||||
// care not to use |l| after moving |args|.
|
||||
template <typename... Args>
|
||||
MOZ_MUST_USE bool putNew(const Lookup& l, Args&&... args)
|
||||
[[nodiscard]] bool putNew(const Lookup& l, Args&&... args)
|
||||
{
|
||||
if (!this->checkSimulatedOOM())
|
||||
return false;
|
||||
@@ -1846,7 +1846,7 @@ class HashTable : private AllocPolicy
|
||||
// Note: |l| may be a reference to a piece of |u|, so this function
|
||||
// must take care not to use |l| after moving |u|.
|
||||
template <typename... Args>
|
||||
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args)
|
||||
[[nodiscard]] bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args)
|
||||
{
|
||||
// Check for error from ensureHash() here.
|
||||
if (p.isValid())
|
||||
|
||||
@@ -1274,7 +1274,7 @@ class MutableWrappedPtrOperations<UniquePtr<T, D>, Container>
|
||||
UniquePtr<T, D>& uniquePtr() { return static_cast<Container*>(this)->get(); }
|
||||
|
||||
public:
|
||||
MOZ_MUST_USE typename UniquePtr<T, D>::Pointer release() { return uniquePtr().release(); }
|
||||
[[nodiscard]] typename UniquePtr<T, D>::Pointer release() { return uniquePtr().release(); }
|
||||
void reset(T* ptr = T()) { uniquePtr().reset(ptr); }
|
||||
};
|
||||
|
||||
|
||||
+11
-11
@@ -285,7 +285,7 @@ class BaseStackFrame {
|
||||
// simplifies the principals check into the boolean isSystem() state. This
|
||||
// is fine because we only expose JS::ubi::Stack to devtools and chrome
|
||||
// code, and not to the web platform.
|
||||
virtual MOZ_MUST_USE bool constructSavedFrameStack(JSContext* cx,
|
||||
[[nodiscard]] virtual bool constructSavedFrameStack(JSContext* cx,
|
||||
MutableHandleObject outSavedFrameStack)
|
||||
const = 0;
|
||||
|
||||
@@ -416,7 +416,7 @@ class StackFrame {
|
||||
StackFrame parent() const { return base()->parent(); }
|
||||
bool isSystem() const { return base()->isSystem(); }
|
||||
bool isSelfHosted(JSContext* cx) const { return base()->isSelfHosted(cx); }
|
||||
MOZ_MUST_USE bool constructSavedFrameStack(JSContext* cx,
|
||||
[[nodiscard]] bool constructSavedFrameStack(JSContext* cx,
|
||||
MutableHandleObject outSavedFrameStack) const {
|
||||
return base()->constructSavedFrameStack(cx, outSavedFrameStack);
|
||||
}
|
||||
@@ -449,7 +449,7 @@ class ConcreteStackFrame<void> : public BaseStackFrame {
|
||||
|
||||
uint64_t identifier() const override { return 0; }
|
||||
void trace(JSTracer* trc) override { }
|
||||
MOZ_MUST_USE bool constructSavedFrameStack(JSContext* cx, MutableHandleObject out)
|
||||
[[nodiscard]] bool constructSavedFrameStack(JSContext* cx, MutableHandleObject out)
|
||||
const override
|
||||
{
|
||||
out.set(nullptr);
|
||||
@@ -465,7 +465,7 @@ class ConcreteStackFrame<void> : public BaseStackFrame {
|
||||
bool isSelfHosted(JSContext* cx) const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
|
||||
};
|
||||
|
||||
MOZ_MUST_USE JS_PUBLIC_API(bool)
|
||||
[[nodiscard]] JS_PUBLIC_API(bool)
|
||||
ConstructSavedFrameStackSlow(JSContext* cx,
|
||||
JS::ubi::StackFrame& frame,
|
||||
MutableHandleObject outSavedFrameStack);
|
||||
@@ -628,7 +628,7 @@ class JS_PUBLIC_API(Base) {
|
||||
// Otherwise, place nullptr in the out parameter. Caller maintains ownership
|
||||
// of the out parameter. True is returned on success, false is returned on
|
||||
// OOM.
|
||||
virtual MOZ_MUST_USE bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
|
||||
[[nodiscard]] virtual bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
|
||||
const
|
||||
{
|
||||
outName.reset(nullptr);
|
||||
@@ -778,7 +778,7 @@ class Node {
|
||||
JS::Zone* zone() const { return base()->zone(); }
|
||||
JSCompartment* compartment() const { return base()->compartment(); }
|
||||
const char* jsObjectClassName() const { return base()->jsObjectClassName(); }
|
||||
MOZ_MUST_USE bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const {
|
||||
[[nodiscard]] bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const {
|
||||
return base()->jsObjectConstructorName(cx, outName);
|
||||
}
|
||||
|
||||
@@ -981,12 +981,12 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(RootList) {
|
||||
RootList(JSContext* cx, Maybe<AutoCheckCannotGC>& noGC, bool wantNames = false);
|
||||
|
||||
// Find all GC roots.
|
||||
MOZ_MUST_USE bool init();
|
||||
[[nodiscard]] bool init();
|
||||
// Find only GC roots in the provided set of |JSCompartment|s.
|
||||
MOZ_MUST_USE bool init(CompartmentSet& debuggees);
|
||||
[[nodiscard]] bool init(CompartmentSet& debuggees);
|
||||
// Find only GC roots in the given Debugger object's set of debuggee
|
||||
// compartments.
|
||||
MOZ_MUST_USE bool init(HandleObject debuggees);
|
||||
[[nodiscard]] bool init(HandleObject debuggees);
|
||||
|
||||
// Returns true if the RootList has been initialized successfully, false
|
||||
// otherwise.
|
||||
@@ -995,7 +995,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(RootList) {
|
||||
// Explicitly add the given Node as a root in this RootList. If wantNames is
|
||||
// true, you must pass an edgeName. The RootList does not take ownership of
|
||||
// edgeName.
|
||||
MOZ_MUST_USE bool addRoot(Node node, const char16_t* edgeName = nullptr);
|
||||
[[nodiscard]] bool addRoot(Node node, const char16_t* edgeName = nullptr);
|
||||
};
|
||||
|
||||
|
||||
@@ -1100,7 +1100,7 @@ class JS_PUBLIC_API(Concrete<JSObject>) : public TracerConcreteWithCompartment<J
|
||||
}
|
||||
|
||||
const char* jsObjectClassName() const override;
|
||||
MOZ_MUST_USE bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
|
||||
[[nodiscard]] bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
|
||||
const override;
|
||||
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
|
||||
|
||||
+11
-11
@@ -104,14 +104,14 @@ struct CountType {
|
||||
|
||||
// Implement the 'count' method for counts returned by this CountType
|
||||
// instance's 'newCount' method.
|
||||
virtual MOZ_MUST_USE bool count(CountBase& count,
|
||||
mozilla::MallocSizeOf mallocSizeOf,
|
||||
const Node& node) = 0;
|
||||
[[nodiscard]] virtual bool count(CountBase& count,
|
||||
mozilla::MallocSizeOf mallocSizeOf,
|
||||
const Node& node) = 0;
|
||||
|
||||
// Implement the 'report' method for counts returned by this CountType
|
||||
// instance's 'newCount' method.
|
||||
virtual MOZ_MUST_USE bool report(JSContext* cx, CountBase& count,
|
||||
MutableHandleValue report) = 0;
|
||||
[[nodiscard]] virtual bool report(JSContext* cx, CountBase& count,
|
||||
MutableHandleValue report) = 0;
|
||||
};
|
||||
|
||||
using CountTypePtr = js::UniquePtr<CountType>;
|
||||
@@ -135,7 +135,7 @@ class CountBase {
|
||||
{ }
|
||||
|
||||
// Categorize and count |node| as appropriate for this count's type.
|
||||
MOZ_MUST_USE bool count(mozilla::MallocSizeOf mallocSizeOf, const Node& node) {
|
||||
[[nodiscard]] bool count(mozilla::MallocSizeOf mallocSizeOf, const Node& node) {
|
||||
total_++;
|
||||
|
||||
auto id = node.identifier();
|
||||
@@ -158,7 +158,7 @@ class CountBase {
|
||||
// Construct a JavaScript object reporting the counts recorded in this
|
||||
// count, and store it in |report|. Return true on success, or false on
|
||||
// failure.
|
||||
MOZ_MUST_USE bool report(JSContext* cx, MutableHandleValue report) {
|
||||
[[nodiscard]] bool report(JSContext* cx, MutableHandleValue report) {
|
||||
return type.report(cx, *this, report);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ struct Census {
|
||||
|
||||
explicit Census(JSContext* cx) : cx(cx), atomsZone(nullptr) { }
|
||||
|
||||
MOZ_MUST_USE JS_PUBLIC_API(bool) init();
|
||||
[[nodiscard]] JS_PUBLIC_API(bool) init();
|
||||
};
|
||||
|
||||
// A BreadthFirst handler type that conducts a census, using a CountBase to
|
||||
@@ -219,14 +219,14 @@ class CensusHandler {
|
||||
mallocSizeOf(mallocSizeOf)
|
||||
{ }
|
||||
|
||||
MOZ_MUST_USE bool report(JSContext* cx, MutableHandleValue report) {
|
||||
[[nodiscard]] bool report(JSContext* cx, MutableHandleValue report) {
|
||||
return rootCount->report(cx, report);
|
||||
}
|
||||
|
||||
// This class needs to retain no per-node data.
|
||||
class NodeData { };
|
||||
|
||||
MOZ_MUST_USE JS_PUBLIC_API(bool) operator() (BreadthFirst<CensusHandler>& traversal,
|
||||
[[nodiscard]] JS_PUBLIC_API(bool) operator() (BreadthFirst<CensusHandler>& traversal,
|
||||
Node origin, const Edge& edge,
|
||||
NodeData* referentData, bool first);
|
||||
};
|
||||
@@ -235,7 +235,7 @@ using CensusTraversal = BreadthFirst<CensusHandler>;
|
||||
|
||||
// Examine the census options supplied by the API consumer, and (among other
|
||||
// things) use that to build a CountType tree.
|
||||
MOZ_MUST_USE JS_PUBLIC_API(bool) ParseCensusOptions(JSContext* cx,
|
||||
[[nodiscard]] JS_PUBLIC_API(bool) ParseCensusOptions(JSContext* cx,
|
||||
Census& census, HandleObject options,
|
||||
CountTypePtr& outResult);
|
||||
|
||||
|
||||
@@ -322,9 +322,9 @@ class DominatorTree
|
||||
|
||||
// Do the post order traversal of the heap graph and populate our
|
||||
// predecessor sets.
|
||||
static MOZ_MUST_USE bool doTraversal(JSContext* cx, AutoCheckCannotGC& noGC, const Node& root,
|
||||
JS::ubi::Vector<Node>& postOrder,
|
||||
PredecessorSets& predecessorSets) {
|
||||
[[nodiscard]] static bool doTraversal(JSContext* cx, AutoCheckCannotGC& noGC, const Node& root,
|
||||
JS::ubi::Vector<Node>& postOrder,
|
||||
PredecessorSets& predecessorSets) {
|
||||
uint32_t nodeCount = 0;
|
||||
auto onNode = [&](const Node& node) {
|
||||
nodeCount++;
|
||||
@@ -356,8 +356,8 @@ class DominatorTree
|
||||
|
||||
// Populates the given `map` with an entry for each node to its index in
|
||||
// `postOrder`.
|
||||
static MOZ_MUST_USE bool mapNodesToTheirIndices(JS::ubi::Vector<Node>& postOrder,
|
||||
NodeToIndexMap& map) {
|
||||
[[nodiscard]] static bool mapNodesToTheirIndices(JS::ubi::Vector<Node>& postOrder,
|
||||
NodeToIndexMap& map) {
|
||||
MOZ_ASSERT(!map.initialized());
|
||||
MOZ_ASSERT(postOrder.length() < UINT32_MAX);
|
||||
uint32_t length = postOrder.length();
|
||||
@@ -370,7 +370,7 @@ class DominatorTree
|
||||
|
||||
// Convert the Node -> NodeSet predecessorSets to a index -> Vector<index>
|
||||
// form.
|
||||
static MOZ_MUST_USE bool convertPredecessorSetsToVectors(
|
||||
[[nodiscard]] static bool convertPredecessorSetsToVectors(
|
||||
const Node& root,
|
||||
JS::ubi::Vector<Node>& postOrder,
|
||||
PredecessorSets& predecessorSets,
|
||||
@@ -409,7 +409,7 @@ class DominatorTree
|
||||
|
||||
// Initialize `doms` such that the immediate dominator of the `root` is the
|
||||
// `root` itself and all others are `UNDEFINED`.
|
||||
static MOZ_MUST_USE bool initializeDominators(JS::ubi::Vector<uint32_t>& doms,
|
||||
[[nodiscard]] static bool initializeDominators(JS::ubi::Vector<uint32_t>& doms,
|
||||
uint32_t length) {
|
||||
MOZ_ASSERT(doms.length() == 0);
|
||||
if (!doms.growByUninitialized(length))
|
||||
@@ -426,7 +426,7 @@ class DominatorTree
|
||||
MOZ_ASSERT_IF(retainedSizes.isSome(), postOrder.length() == retainedSizes->length());
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool computeRetainedSizes(mozilla::MallocSizeOf mallocSizeOf) {
|
||||
[[nodiscard]] bool computeRetainedSizes(mozilla::MallocSizeOf mallocSizeOf) {
|
||||
MOZ_ASSERT(retainedSizes.isNothing());
|
||||
auto length = postOrder.length();
|
||||
|
||||
@@ -651,7 +651,7 @@ class DominatorTree
|
||||
* `outSize`, or 0 if `node` is not a member of the dominator tree. Returns
|
||||
* false on OOM failure, leaving `outSize` unchanged.
|
||||
*/
|
||||
MOZ_MUST_USE bool getRetainedSize(const Node& node, mozilla::MallocSizeOf mallocSizeOf,
|
||||
[[nodiscard]] bool getRetainedSize(const Node& node, mozilla::MallocSizeOf mallocSizeOf,
|
||||
Node::Size& outSize) {
|
||||
assertSanity();
|
||||
auto ptr = nodeToPostOrderIndex.lookup(node);
|
||||
|
||||
@@ -90,7 +90,7 @@ struct PostOrder {
|
||||
#endif
|
||||
|
||||
private:
|
||||
MOZ_MUST_USE bool fillEdgesFromRange(EdgeVector& edges, js::UniquePtr<EdgeRange>& range) {
|
||||
[[nodiscard]] bool fillEdgesFromRange(EdgeVector& edges, js::UniquePtr<EdgeRange>& range) {
|
||||
MOZ_ASSERT(range);
|
||||
for ( ; !range->empty(); range->popFront()) {
|
||||
if (!edges.append(mozilla::Move(range->front())))
|
||||
@@ -99,7 +99,7 @@ struct PostOrder {
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool pushForTraversing(const Node& node) {
|
||||
[[nodiscard]] bool pushForTraversing(const Node& node) {
|
||||
EdgeVector edges;
|
||||
auto range = node.edges(cx, /* wantNames */ false);
|
||||
return range &&
|
||||
@@ -124,11 +124,11 @@ struct PostOrder {
|
||||
{ }
|
||||
|
||||
// Initialize this traversal object. Return false on OOM.
|
||||
MOZ_MUST_USE bool init() { return seen.init(); }
|
||||
[[nodiscard]] bool init() { return seen.init(); }
|
||||
|
||||
// Add `node` as a starting point for the traversal. You may add
|
||||
// as many starting points as you like. Returns false on OOM.
|
||||
MOZ_MUST_USE bool addStart(const Node& node) {
|
||||
[[nodiscard]] bool addStart(const Node& node) {
|
||||
if (!seen.put(node))
|
||||
return false;
|
||||
return pushForTraversing(node);
|
||||
@@ -144,7 +144,7 @@ struct PostOrder {
|
||||
// Return false on OOM or error return from `onNode::operator()` or
|
||||
// `onEdge::operator()`.
|
||||
template<typename NodeVisitor, typename EdgeVisitor>
|
||||
MOZ_MUST_USE bool traverse(NodeVisitor onNode, EdgeVisitor onEdge) {
|
||||
[[nodiscard]] bool traverse(NodeVisitor onNode, EdgeVisitor onEdge) {
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(!traversed, "Can only traverse() once!");
|
||||
traversed = true;
|
||||
|
||||
@@ -32,7 +32,7 @@ struct JS_PUBLIC_API(BackEdge)
|
||||
|
||||
BackEdge() : predecessor_(), name_(nullptr) { }
|
||||
|
||||
MOZ_MUST_USE bool init(const Node& predecessor, Edge& edge) {
|
||||
[[nodiscard]] bool init(const Node& predecessor, Edge& edge) {
|
||||
MOZ_ASSERT(!predecessor_);
|
||||
MOZ_ASSERT(!name_);
|
||||
|
||||
@@ -289,7 +289,7 @@ struct JS_PUBLIC_API(ShortestPaths)
|
||||
* the given target, in which case `func` will not be invoked.
|
||||
*/
|
||||
template <class Func>
|
||||
MOZ_MUST_USE bool forEachPath(const Node& target, Func func) {
|
||||
[[nodiscard]] bool forEachPath(const Node& target, Func func) {
|
||||
MOZ_ASSERT(initialized());
|
||||
MOZ_ASSERT(targets_.has(target));
|
||||
|
||||
|
||||
+2
-2
@@ -352,7 +352,7 @@ namespace js {
|
||||
* instances of type |T|. Return false if the calculation overflowed.
|
||||
*/
|
||||
template <typename T>
|
||||
MOZ_MUST_USE inline bool
|
||||
[[nodiscard]] inline bool
|
||||
CalculateAllocSize(size_t numElems, size_t* bytesOut)
|
||||
{
|
||||
*bytesOut = numElems * sizeof(T);
|
||||
@@ -365,7 +365,7 @@ CalculateAllocSize(size_t numElems, size_t* bytesOut)
|
||||
* false if the calculation overflowed.
|
||||
*/
|
||||
template <typename T, typename Extra>
|
||||
MOZ_MUST_USE inline bool
|
||||
[[nodiscard]] inline bool
|
||||
CalculateAllocSizeWithExtra(size_t numExtra, size_t* bytesOut)
|
||||
{
|
||||
*bytesOut = sizeof(T) + numExtra * sizeof(Extra);
|
||||
|
||||
@@ -21,21 +21,21 @@ class AtomicsObject : public JSObject
|
||||
public:
|
||||
static const Class class_;
|
||||
static JSObject* initClass(JSContext* cx, Handle<GlobalObject*> global);
|
||||
static MOZ_MUST_USE bool toString(JSContext* cx, unsigned int argc, Value* vp);
|
||||
[[nodiscard]] static bool toString(JSContext* cx, unsigned int argc, Value* vp);
|
||||
};
|
||||
|
||||
MOZ_MUST_USE bool atomics_compareExchange(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_exchange(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_load(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_store(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_add(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_sub(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_and(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_or(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_xor(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_isLockFree(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_wait(JSContext* cx, unsigned argc, Value* vp);
|
||||
MOZ_MUST_USE bool atomics_notify(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_compareExchange(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_exchange(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_load(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_store(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_add(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_sub(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_and(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_or(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_xor(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_isLockFree(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_wait(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool atomics_notify(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/* asm.js callouts */
|
||||
namespace wasm { class Instance; }
|
||||
@@ -52,14 +52,14 @@ class FutexRuntime
|
||||
friend class AutoLockFutexAPI;
|
||||
|
||||
public:
|
||||
static MOZ_MUST_USE bool initialize();
|
||||
[[nodiscard]] static bool initialize();
|
||||
static void destroy();
|
||||
|
||||
static void lock();
|
||||
static void unlock();
|
||||
|
||||
FutexRuntime();
|
||||
MOZ_MUST_USE bool initInstance();
|
||||
[[nodiscard]] bool initInstance();
|
||||
void destroyInstance();
|
||||
|
||||
// Parameters to notify().
|
||||
@@ -83,8 +83,8 @@ public:
|
||||
// wait.
|
||||
//
|
||||
// wait() will not wake up spuriously.
|
||||
MOZ_MUST_USE bool wait(JSContext* cx, js::UniqueLock<js::Mutex>& locked,
|
||||
mozilla::Maybe<mozilla::TimeDuration>& timeout, WaitResult* result);
|
||||
[[nodiscard]] bool wait(JSContext* cx, js::UniqueLock<js::Mutex>& locked,
|
||||
mozilla::Maybe<mozilla::TimeDuration>& timeout, WaitResult* result);
|
||||
|
||||
// Notify the thread represented by this Runtime.
|
||||
//
|
||||
|
||||
@@ -16,17 +16,17 @@ namespace js {
|
||||
// JSOP_EVAL which in turn calls DirectEval. Thus, even though IndirectEval is
|
||||
// the callee function object for *all* calls to eval, it is by construction
|
||||
// only ever called in the case indirect eval.
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
IndirectEval(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
// Performs a direct eval of |v| (a string containing code, or another value
|
||||
// that will be vacuously returned), which must correspond to the currently-
|
||||
// executing stack frame, which must be a script frame.
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
DirectEval(JSContext* cx, HandleValue v, MutableHandleValue vp);
|
||||
|
||||
// Performs a direct eval called from Ion code.
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
DirectEvalStringFromIon(JSContext* cx,
|
||||
HandleObject scopeObj, HandleScript callerScript,
|
||||
HandleValue newTargetValue, HandleString str,
|
||||
|
||||
@@ -476,7 +476,7 @@ class js::OrderedHashTableRef : public gc::BufferableRef
|
||||
};
|
||||
|
||||
template <typename ObjectT>
|
||||
inline static MOZ_MUST_USE bool
|
||||
[[nodiscard]] inline static bool
|
||||
WriteBarrierPostImpl(JSRuntime* rt, ObjectT* obj, const Value& keyValue)
|
||||
{
|
||||
if (MOZ_LIKELY(!keyValue.isObject()))
|
||||
@@ -501,13 +501,13 @@ WriteBarrierPostImpl(JSRuntime* rt, ObjectT* obj, const Value& keyValue)
|
||||
return true;
|
||||
}
|
||||
|
||||
inline static MOZ_MUST_USE bool
|
||||
[[nodiscard]] inline static bool
|
||||
WriteBarrierPost(JSRuntime* rt, MapObject* map, const Value& key)
|
||||
{
|
||||
return WriteBarrierPostImpl(rt, map, key);
|
||||
}
|
||||
|
||||
inline static MOZ_MUST_USE bool
|
||||
[[nodiscard]] inline static bool
|
||||
WriteBarrierPost(JSRuntime* rt, SetObject* set, const Value& key)
|
||||
{
|
||||
return WriteBarrierPostImpl(rt, set, key);
|
||||
|
||||
+53
-53
@@ -41,7 +41,7 @@ class HashableValue
|
||||
|
||||
HashableValue() : value(UndefinedValue()) {}
|
||||
|
||||
MOZ_MUST_USE bool setValue(JSContext* cx, HandleValue v);
|
||||
[[nodiscard]] bool setValue(JSContext* cx, HandleValue v);
|
||||
HashNumber hash(const mozilla::HashCodeScrambler& hcs) const;
|
||||
bool operator==(const HashableValue& other) const;
|
||||
HashableValue mark(JSTracer* trc) const;
|
||||
@@ -66,7 +66,7 @@ class MutableWrappedPtrOperations<HashableValue, Wrapper>
|
||||
: public WrappedPtrOperations<HashableValue, Wrapper>
|
||||
{
|
||||
public:
|
||||
MOZ_MUST_USE bool setValue(JSContext* cx, HandleValue v) {
|
||||
[[nodiscard]] bool setValue(JSContext* cx, HandleValue v) {
|
||||
return static_cast<Wrapper*>(this)->get().setValue(cx, v);
|
||||
}
|
||||
};
|
||||
@@ -107,26 +107,26 @@ class MapObject : public NativeObject {
|
||||
|
||||
enum { NurseryKeysSlot, SlotCount };
|
||||
|
||||
static MOZ_MUST_USE bool getKeysAndValuesInterleaved(JSContext* cx, HandleObject obj,
|
||||
[[nodiscard]] static bool getKeysAndValuesInterleaved(JSContext* cx, HandleObject obj,
|
||||
JS::MutableHandle<GCVector<JS::Value>> entries);
|
||||
static MOZ_MUST_USE bool entries(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool has(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool entries(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool has(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MapObject* create(JSContext* cx, HandleObject proto = nullptr);
|
||||
|
||||
// Publicly exposed Map calls for JSAPI access (webidl maplike/setlike
|
||||
// interfaces, etc.)
|
||||
static uint32_t size(JSContext *cx, HandleObject obj);
|
||||
static MOZ_MUST_USE bool get(JSContext *cx, HandleObject obj, HandleValue key,
|
||||
[[nodiscard]] static bool get(JSContext *cx, HandleObject obj, HandleValue key,
|
||||
MutableHandleValue rval);
|
||||
static MOZ_MUST_USE bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||
static MOZ_MUST_USE bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||
[[nodiscard]] static bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||
[[nodiscard]] static bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||
|
||||
// Set call for public JSAPI exposure. Does not actually return map object
|
||||
// as stated in spec, expects caller to return a value. for instance, with
|
||||
// webidl maplike/setlike, should return interface object.
|
||||
static MOZ_MUST_USE bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val);
|
||||
static MOZ_MUST_USE bool clear(JSContext *cx, HandleObject obj);
|
||||
static MOZ_MUST_USE bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
|
||||
[[nodiscard]] static bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val);
|
||||
[[nodiscard]] static bool clear(JSContext *cx, HandleObject obj);
|
||||
[[nodiscard]] static bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
|
||||
MutableHandleValue iter);
|
||||
|
||||
using UnbarrieredTable = OrderedHashMap<Value, Value, UnbarrieredHashPolicy, RuntimeAllocPolicy>;
|
||||
@@ -143,29 +143,29 @@ class MapObject : public NativeObject {
|
||||
static ValueMap& extract(const CallArgs& args);
|
||||
static void mark(JSTracer* trc, JSObject* obj);
|
||||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
static bool is(HandleValue v);
|
||||
static bool is(HandleObject o);
|
||||
|
||||
static MOZ_MUST_USE bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
|
||||
[[nodiscard]] static bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
|
||||
|
||||
static MOZ_MUST_USE bool size_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool size(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool get_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool get(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool has_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool set_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool set(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool delete_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool delete_(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool keys_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool keys(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool values_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool values(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool entries_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool clear_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool clear(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool size_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool size(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool get_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool get(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool has_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool set_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool set(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool delete_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool delete_(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool keys_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool keys(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool values_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool values(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool entries_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool clear_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool clear(JSContext* cx, unsigned argc, Value* vp);
|
||||
};
|
||||
|
||||
class MapIteratorObject : public NativeObject
|
||||
@@ -187,7 +187,7 @@ class MapIteratorObject : public NativeObject
|
||||
MapObject::IteratorKind kind);
|
||||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
|
||||
static MOZ_MUST_USE bool next(Handle<MapIteratorObject*> mapIterator,
|
||||
[[nodiscard]] static bool next(Handle<MapIteratorObject*> mapIterator,
|
||||
HandleArrayObject resultPairObj, JSContext* cx);
|
||||
|
||||
static JSObject* createResultPair(JSContext* cx);
|
||||
@@ -213,21 +213,21 @@ class SetObject : public NativeObject {
|
||||
|
||||
enum { NurseryKeysSlot, SlotCount };
|
||||
|
||||
static MOZ_MUST_USE bool keys(JSContext *cx, HandleObject obj,
|
||||
[[nodiscard]] static bool keys(JSContext *cx, HandleObject obj,
|
||||
JS::MutableHandle<GCVector<JS::Value>> keys);
|
||||
static MOZ_MUST_USE bool values(JSContext *cx, unsigned argc, Value *vp);
|
||||
static MOZ_MUST_USE bool add(JSContext *cx, HandleObject obj, HandleValue key);
|
||||
static MOZ_MUST_USE bool has(JSContext *cx, unsigned argc, Value *vp);
|
||||
[[nodiscard]] static bool values(JSContext *cx, unsigned argc, Value *vp);
|
||||
[[nodiscard]] static bool add(JSContext *cx, HandleObject obj, HandleValue key);
|
||||
[[nodiscard]] static bool has(JSContext *cx, unsigned argc, Value *vp);
|
||||
|
||||
// Publicly exposed Set calls for JSAPI access (webidl maplike/setlike
|
||||
// interfaces, etc.)
|
||||
static SetObject* create(JSContext *cx, HandleObject proto = nullptr);
|
||||
static uint32_t size(JSContext *cx, HandleObject obj);
|
||||
static MOZ_MUST_USE bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||
static MOZ_MUST_USE bool clear(JSContext *cx, HandleObject obj);
|
||||
static MOZ_MUST_USE bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
|
||||
[[nodiscard]] static bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||
[[nodiscard]] static bool clear(JSContext *cx, HandleObject obj);
|
||||
[[nodiscard]] static bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
|
||||
MutableHandleValue iter);
|
||||
static MOZ_MUST_USE bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool *rval);
|
||||
[[nodiscard]] static bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool *rval);
|
||||
|
||||
using UnbarrieredTable = OrderedHashSet<Value, UnbarrieredHashPolicy, RuntimeAllocPolicy>;
|
||||
friend class OrderedHashTableRef<SetObject>;
|
||||
@@ -251,20 +251,20 @@ class SetObject : public NativeObject {
|
||||
|
||||
static bool isBuiltinAdd(HandleValue add, JSContext* cx);
|
||||
|
||||
static MOZ_MUST_USE bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
|
||||
[[nodiscard]] static bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
|
||||
|
||||
static MOZ_MUST_USE bool size_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool size(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool has_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool add_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool add(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool delete_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool delete_(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool values_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool entries_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool entries(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool clear_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool clear(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool size_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool size(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool has_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool add_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool add(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool delete_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool delete_(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool values_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool entries_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool entries(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool clear_impl(JSContext* cx, const CallArgs& args);
|
||||
[[nodiscard]] static bool clear(JSContext* cx, unsigned argc, Value* vp);
|
||||
};
|
||||
|
||||
class SetIteratorObject : public NativeObject
|
||||
@@ -286,7 +286,7 @@ class SetIteratorObject : public NativeObject
|
||||
SetObject::IteratorKind kind);
|
||||
static void finalize(FreeOp* fop, JSObject* obj);
|
||||
|
||||
static MOZ_MUST_USE bool next(Handle<SetIteratorObject*> setIterator,
|
||||
[[nodiscard]] static bool next(Handle<SetIteratorObject*> setIterator,
|
||||
HandleArrayObject resultObj, JSContext* cx);
|
||||
|
||||
static JSObject* createResult(JSContext* cx);
|
||||
@@ -299,7 +299,7 @@ using SetInitGetPrototypeOp = NativeObject* (*)(JSContext*, Handle<GlobalObject*
|
||||
using SetInitIsBuiltinOp = bool (*)(HandleValue, JSContext*);
|
||||
|
||||
template <SetInitGetPrototypeOp getPrototypeOp, SetInitIsBuiltinOp isBuiltinOp>
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
IsOptimizableInitForSet(JSContext* cx, HandleObject setObject, HandleValue iterable, bool* optimized)
|
||||
{
|
||||
MOZ_ASSERT(!*optimized);
|
||||
|
||||
+13
-13
@@ -18,10 +18,10 @@ class Value;
|
||||
namespace js {
|
||||
|
||||
// Object constructor native. Exposed only so the JIT can know its address.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_construct(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_propertyIsEnumerable(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
PlainObject*
|
||||
@@ -32,32 +32,32 @@ PlainObject*
|
||||
ObjectCreateWithTemplate(JSContext* cx, HandlePlainObject templateObj);
|
||||
|
||||
// Object methods exposed so they can be installed in the self-hosting global.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_create(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_defineProperty(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_getOwnPropertyNames(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_getOwnPropertyDescriptor(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_getPrototypeOf(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_hasOwnProperty(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_isExtensible(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
obj_toString(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
// Exposed so SelfHosting.cpp can use it in the OwnPropertyKeys intrinsic
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
GetOwnPropertyKeys(JSContext* cx, const JS::CallArgs& args, unsigned flags);
|
||||
|
||||
/*
|
||||
@@ -65,7 +65,7 @@ GetOwnPropertyKeys(JSContext* cx, const JS::CallArgs& args, unsigned flags);
|
||||
* exposing a jsid to script for Object.getOwnProperty{Names,Symbols}
|
||||
* or scriptable proxy traps.
|
||||
*/
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
IdToStringOrSymbol(JSContext* cx, JS::HandleId id, JS::MutableHandleValue result);
|
||||
|
||||
#if JS_HAS_TOSOURCE
|
||||
@@ -74,7 +74,7 @@ JSString*
|
||||
ObjectToSource(JSContext* cx, JS::HandleObject obj);
|
||||
#endif // JS_HAS_TOSOURCE
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
WatchHandler(JSContext* cx, JSObject* obj, jsid id, const JS::Value& old,
|
||||
JS::Value* nvp, void* closure);
|
||||
|
||||
|
||||
+10
-10
@@ -29,21 +29,21 @@ typedef int pid_t;
|
||||
*
|
||||
* Returns true if no profilers fail to start.
|
||||
*/
|
||||
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
|
||||
[[nodiscard]] extern JS_PUBLIC_API(bool)
|
||||
JS_StartProfiling(const char* profileName, pid_t pid);
|
||||
|
||||
/**
|
||||
* Stop any profilers that were previously started with JS_StartProfiling.
|
||||
* Returns true if no profilers fail to stop.
|
||||
*/
|
||||
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
|
||||
[[nodiscard]] extern JS_PUBLIC_API(bool)
|
||||
JS_StopProfiling(const char* profileName);
|
||||
|
||||
/**
|
||||
* Write the current profile data to the given file, if applicable to whatever
|
||||
* profiler is being used.
|
||||
*/
|
||||
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
|
||||
[[nodiscard]] extern JS_PUBLIC_API(bool)
|
||||
JS_DumpProfile(const char* outfile, const char* profileName);
|
||||
|
||||
/**
|
||||
@@ -51,13 +51,13 @@ JS_DumpProfile(const char* outfile, const char* profileName);
|
||||
* whether any profilers failed to pause. (Profilers that do not support
|
||||
* pause/resume do not count.)
|
||||
*/
|
||||
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
|
||||
[[nodiscard]] extern JS_PUBLIC_API(bool)
|
||||
JS_PauseProfilers(const char* profileName);
|
||||
|
||||
/**
|
||||
* Resume suspended profilers
|
||||
*/
|
||||
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
|
||||
[[nodiscard]] extern JS_PUBLIC_API(bool)
|
||||
JS_ResumeProfilers(const char* profileName);
|
||||
|
||||
/**
|
||||
@@ -70,23 +70,23 @@ JS_UnsafeGetLastProfilingError();
|
||||
|
||||
#ifdef MOZ_CALLGRIND
|
||||
|
||||
extern MOZ_MUST_USE JS_FRIEND_API(bool)
|
||||
[[nodiscard]] extern JS_FRIEND_API(bool)
|
||||
js_StopCallgrind();
|
||||
|
||||
extern MOZ_MUST_USE JS_FRIEND_API(bool)
|
||||
[[nodiscard]] extern JS_FRIEND_API(bool)
|
||||
js_StartCallgrind();
|
||||
|
||||
extern MOZ_MUST_USE JS_FRIEND_API(bool)
|
||||
[[nodiscard]] extern JS_FRIEND_API(bool)
|
||||
js_DumpCallgrind(const char* outfile);
|
||||
|
||||
#endif /* MOZ_CALLGRIND */
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
extern MOZ_MUST_USE JS_FRIEND_API(bool)
|
||||
[[nodiscard]] extern JS_FRIEND_API(bool)
|
||||
js_StartPerf();
|
||||
|
||||
extern MOZ_MUST_USE JS_FRIEND_API(bool)
|
||||
[[nodiscard]] extern JS_FRIEND_API(bool)
|
||||
js_StopPerf();
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
+69
-69
@@ -311,7 +311,7 @@ class MutableWrappedPtrOperations<PromiseCombinatorElements, Wrapper>
|
||||
elements().setElementNeedsWrapping = needsWrapping;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool pushUndefined(JSContext* cx) {
|
||||
[[nodiscard]] bool pushUndefined(JSContext* cx) {
|
||||
// Helper for the AutoCompartment we need to work with |array|. We mostly do this
|
||||
// for performance; we could go ahead and do the define via a cross-
|
||||
// compartment proxy instead...
|
||||
@@ -335,7 +335,7 @@ class MutableWrappedPtrOperations<PromiseCombinatorElements, Wrapper>
|
||||
// Promise.all/allSettled/any function, which isn't necessarily the same
|
||||
// compartment as unwrappedArray as explained in NewPromiseCombinatorElements.
|
||||
// So before storing |val| we may need to enter unwrappedArray's compartment.
|
||||
MOZ_MUST_USE bool setElement(JSContext* cx, uint32_t index, HandleValue val) {
|
||||
[[nodiscard]] bool setElement(JSContext* cx, uint32_t index, HandleValue val) {
|
||||
// The index is guaranteed to be initialized to `undefined`.
|
||||
MOZ_ASSERT(unwrappedArray()->getDenseElement(index).isUndefined());
|
||||
|
||||
@@ -560,7 +560,7 @@ MaybeGetAndClearException(JSContext* cx, MutableHandleValue rval)
|
||||
return GetAndClearException(cx, rval);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool RunResolutionFunction(JSContext *cx, HandleObject resolutionFun,
|
||||
[[nodiscard]] static bool RunResolutionFunction(JSContext *cx, HandleObject resolutionFun,
|
||||
HandleValue result, ResolutionMode mode,
|
||||
HandleObject promiseObj);
|
||||
|
||||
@@ -778,7 +778,7 @@ static bool ResolvePromiseFunction(JSContext* cx, unsigned argc, Value* vp);
|
||||
static bool RejectPromiseFunction(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
// ES2016, 25.4.1.3.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
CreateResolvingFunctions(JSContext* cx, HandleObject promise,
|
||||
MutableHandleObject resolveFn,
|
||||
MutableHandleObject rejectFn)
|
||||
@@ -823,11 +823,11 @@ IsSettledMaybeWrappedPromise(JSObject* promise)
|
||||
}
|
||||
|
||||
// ES2016, 25.4.1.7.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
RejectMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue reason);
|
||||
|
||||
// ES2016, 25.4.1.7.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
RejectPromiseInternal(JSContext* cx, Handle<PromiseObject*> promise, HandleValue reason);
|
||||
|
||||
// ES2016, 25.4.1.3.1.
|
||||
@@ -874,15 +874,15 @@ RejectPromiseFunction(JSContext* cx, unsigned argc, Value* vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj,
|
||||
[[nodiscard]] static bool FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj,
|
||||
HandleValue value_);
|
||||
|
||||
static MOZ_MUST_USE bool EnqueuePromiseResolveThenableJob(JSContext* cx,
|
||||
[[nodiscard]] static bool EnqueuePromiseResolveThenableJob(JSContext* cx,
|
||||
HandleValue promiseToResolve,
|
||||
HandleValue thenable,
|
||||
HandleValue thenVal);
|
||||
|
||||
static MOZ_MUST_USE bool EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx,
|
||||
[[nodiscard]] static bool EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx,
|
||||
HandleObject promiseToResolve,
|
||||
HandleObject thenable);
|
||||
|
||||
@@ -891,7 +891,7 @@ static bool Promise_then_impl(JSContext* cx, HandleValue promiseVal, HandleValue
|
||||
HandleValue onRejected, MutableHandleValue rval, bool rvalUsed);
|
||||
|
||||
// ES2016, 25.4.1.3.2, steps 6-13.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
ResolvePromiseInternal(JSContext* cx, HandleObject promise, HandleValue resolutionVal)
|
||||
{
|
||||
assertSameCompartment(cx, promise, resolutionVal);
|
||||
@@ -1024,7 +1024,7 @@ static bool PromiseReactionJob(JSContext* cx, unsigned argc, Value* vp);
|
||||
* targetState - The PromiseState this reaction job targets. This decides
|
||||
* whether the onFulfilled or onRejected handler is called.
|
||||
*/
|
||||
MOZ_MUST_USE static bool
|
||||
[[nodiscard]] static bool
|
||||
EnqueuePromiseReactionJob(JSContext* cx, HandleObject reactionObj,
|
||||
HandleValue handlerArg_, JS::PromiseState targetState)
|
||||
{
|
||||
@@ -1130,11 +1130,11 @@ EnqueuePromiseReactionJob(JSContext* cx, HandleObject reactionObj,
|
||||
return cx->runtime()->enqueuePromiseJob(cx, job, promise, global);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal,
|
||||
[[nodiscard]] static bool TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal,
|
||||
JS::PromiseState state, HandleValue valueOrReason);
|
||||
|
||||
// ES2016, Commoned-out implementation of 25.4.1.4. and 25.4.1.7.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
ResolvePromise(JSContext* cx, Handle<PromiseObject*> promise, HandleValue valueOrReason,
|
||||
JS::PromiseState state)
|
||||
{
|
||||
@@ -1177,14 +1177,14 @@ ResolvePromise(JSContext* cx, Handle<PromiseObject*> promise, HandleValue valueO
|
||||
}
|
||||
|
||||
// ES2016, 25.4.1.7.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
RejectPromiseInternal(JSContext* cx, Handle<PromiseObject*> promise, HandleValue reason)
|
||||
{
|
||||
return ResolvePromise(cx, promise, reason, JS::PromiseState::Rejected);
|
||||
}
|
||||
|
||||
// ES2016, 25.4.1.4.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue value_)
|
||||
{
|
||||
Rooted<PromiseObject*> promise(cx);
|
||||
@@ -1210,7 +1210,7 @@ FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue v
|
||||
|
||||
static bool GetCapabilitiesExecutor(JSContext* cx, unsigned argc, Value* vp);
|
||||
static bool PromiseConstructor(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE PromiseObject* CreatePromiseObjectInternal(JSContext* cx,
|
||||
[[nodiscard]] static PromiseObject* CreatePromiseObjectInternal(JSContext* cx,
|
||||
HandleObject proto = nullptr,
|
||||
bool protoIsWrapped = false,
|
||||
bool informDebugger = true);
|
||||
@@ -1220,7 +1220,7 @@ enum GetCapabilitiesExecutorSlots {
|
||||
GetCapabilitiesExecutorSlots_Reject
|
||||
};
|
||||
|
||||
static MOZ_MUST_USE PromiseObject*
|
||||
[[nodiscard]] static PromiseObject*
|
||||
CreatePromiseObjectWithoutResolutionFunctions(JSContext* cx)
|
||||
{
|
||||
Rooted<PromiseObject*> promise(cx, CreatePromiseObjectInternal(cx));
|
||||
@@ -1231,7 +1231,7 @@ CreatePromiseObjectWithoutResolutionFunctions(JSContext* cx)
|
||||
return promise;
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE PromiseObject*
|
||||
[[nodiscard]] static PromiseObject*
|
||||
CreatePromiseWithDefaultResolutionFunctions(JSContext* cx, MutableHandleObject resolve,
|
||||
MutableHandleObject reject)
|
||||
{
|
||||
@@ -1258,7 +1258,7 @@ CreatePromiseWithDefaultResolutionFunctions(JSContext* cx, MutableHandleObject r
|
||||
}
|
||||
|
||||
// ES2016, 25.4.1.5.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
NewPromiseCapability(JSContext* cx, HandleObject C, MutableHandle<PromiseCapability> capability,
|
||||
bool canOmitResolutionFunctions)
|
||||
{
|
||||
@@ -1369,7 +1369,7 @@ GetCapabilitiesExecutor(JSContext* cx, unsigned argc, Value* vp)
|
||||
}
|
||||
|
||||
// ES2016, 25.4.1.7.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
RejectMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue reason_)
|
||||
{
|
||||
Rooted<PromiseObject*> promise(cx);
|
||||
@@ -1410,7 +1410,7 @@ RejectMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue re
|
||||
}
|
||||
|
||||
// ES2016, 25.4.1.8.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal, JS::PromiseState state,
|
||||
HandleValue valueOrReason)
|
||||
{
|
||||
@@ -1440,7 +1440,7 @@ TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal, JS::PromiseStat
|
||||
// Implements PromiseReactionJob optimized for the case when the reaction
|
||||
// handler is one of the default resolving functions as created by the
|
||||
// CreateResolvingFunctions abstract operation.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
DefaultResolvingPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction,
|
||||
MutableHandleValue rval)
|
||||
{
|
||||
@@ -1485,7 +1485,7 @@ DefaultResolvingPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*>
|
||||
return true;
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AsyncFunctionPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction,
|
||||
MutableHandleValue rval)
|
||||
{
|
||||
@@ -1513,7 +1513,7 @@ AsyncFunctionPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> re
|
||||
return true;
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AsyncGeneratorPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction,
|
||||
MutableHandleValue rval)
|
||||
{
|
||||
@@ -1723,7 +1723,7 @@ PromiseResolveThenableJob(JSContext* cx, unsigned argc, Value* vp)
|
||||
return Call(cx, rejectVal, UndefinedHandleValue, rval, &rval);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
OriginalPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
Handle<PromiseObject*> promiseToResolve);
|
||||
|
||||
@@ -1785,7 +1785,7 @@ PromiseResolveBuiltinThenableJob(JSContext* cx, unsigned argc, Value* vp)
|
||||
* thenable_ - The thenable to resolve the Promise with.
|
||||
* thenVal - The `then` function to invoke with the `thenable` as the receiver.
|
||||
*/
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
EnqueuePromiseResolveThenableJob(JSContext* cx, HandleValue promiseToResolve_,
|
||||
HandleValue thenable_, HandleValue thenVal)
|
||||
{
|
||||
@@ -1847,7 +1847,7 @@ EnqueuePromiseResolveThenableJob(JSContext* cx, HandleValue promiseToResolve_,
|
||||
* promiseToResolve - The promise to resolve, obviously.
|
||||
* thenable - The thenable to resolve the Promise with.
|
||||
*/
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx, HandleObject promiseToResolve,
|
||||
HandleObject thenable)
|
||||
{
|
||||
@@ -1869,11 +1869,11 @@ EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx, HandleObject promiseToRes
|
||||
return cx->runtime()->enqueuePromiseJob(cx, job, promiseToResolve, incumbentGlobal);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AddDummyPromiseReactionForDebugger(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleObject dependentPromise);
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AddPromiseReaction(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
Handle<PromiseReactionRecord*> reaction);
|
||||
|
||||
@@ -1947,7 +1947,7 @@ ClearResolutionFunctionSlots(JSFunction* resolutionFun)
|
||||
}
|
||||
|
||||
// ES2016, 25.4.3.1. steps 3-7.
|
||||
static MOZ_MUST_USE PromiseObject*
|
||||
[[nodiscard]] static PromiseObject*
|
||||
CreatePromiseObjectInternal(JSContext* cx, HandleObject proto /* = nullptr */,
|
||||
bool protoIsWrapped /* = false */, bool informDebugger /* = true */)
|
||||
{
|
||||
@@ -2175,19 +2175,19 @@ class MOZ_STACK_CLASS PromiseForOfIterator : public JS::ForOfIterator {
|
||||
}
|
||||
};
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseAll(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseAllSettled(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseAny(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseRace(JSContext* cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
|
||||
|
||||
@@ -2204,7 +2204,7 @@ enum class CombinatorKind { All, AllSettled, Any, Race };
|
||||
// https://tc39.es/proposal-promise-any/
|
||||
//
|
||||
// Promise.any ( iterable )
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
CommonPromiseCombinator(JSContext* cx, CallArgs& args, CombinatorKind mode)
|
||||
{
|
||||
HandleValue iterable = args.get(0);
|
||||
@@ -2340,11 +2340,11 @@ static bool Promise_static_all(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return CommonPromiseCombinator(cx, args, CombinatorKind::All);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseThen(JSContext* cx, Handle<PromiseObject*> promise, HandleValue onFulfilled_,
|
||||
HandleValue onRejected_, Handle<PromiseCapability> resultCapability);
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
Handle<PromiseObject*> promiseToResolve,
|
||||
Handle<PromiseCapability> resultCapability);
|
||||
@@ -2356,7 +2356,7 @@ static JSFunction* NewPromiseCombinatorElementFunction(
|
||||
static bool PromiseAllResolveElementFunction(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
// Unforgeable version of ES2016, 25.4.4.1.
|
||||
MOZ_MUST_USE JSObject*
|
||||
[[nodiscard]] JSObject*
|
||||
js::GetWaitForAllPromise(JSContext* cx, const JS::AutoObjectVector& promises)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@@ -2476,7 +2476,7 @@ js::GetWaitForAllPromise(JSContext* cx, const JS::AutoObjectVector& promises)
|
||||
return resultCapability.promise();
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
RunResolutionFunction(JSContext *cx, HandleObject resolutionFun, HandleValue result,
|
||||
ResolutionMode mode, HandleObject promiseObj)
|
||||
{
|
||||
@@ -2528,7 +2528,7 @@ RunResolutionFunction(JSContext *cx, HandleObject resolutionFun, HandleValue res
|
||||
return RejectPromiseInternal(cx, promise, result);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE JSObject*
|
||||
[[nodiscard]] static JSObject*
|
||||
CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue argVal,
|
||||
ResolutionMode mode);
|
||||
|
||||
@@ -2544,7 +2544,7 @@ IsPromiseSpecies(JSContext* cx, JSFunction* species);
|
||||
// https://tc39.es/proposal-promise-any/
|
||||
// Runtime Semantics: PerformPromiseAny, steps 6-8.
|
||||
template <typename T>
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
CommonPerformPromiseCombinator(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
HandleObject resultPromise, HandleValue promiseResolve, bool* done,
|
||||
bool resolveReturnsUndefined, T getResolveAndReject)
|
||||
@@ -2810,7 +2810,7 @@ CommonPerformPromiseCombinator(JSContext *cx, PromiseForOfIterator& iterator, Ha
|
||||
|
||||
// Create the elements for the Promise combinators Promise.all and
|
||||
// Promise.allSettled.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
NewPromiseCombinatorElements(JSContext* cx, Handle<PromiseCapability> resultCapability,
|
||||
MutableHandle<PromiseCombinatorElements> elements)
|
||||
{
|
||||
@@ -2862,7 +2862,7 @@ NewPromiseCombinatorElements(JSContext* cx, Handle<PromiseCapability> resultCapa
|
||||
}
|
||||
|
||||
// Retrieve the combinator elements from the data holder.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
GetPromiseCombinatorElements(JSContext* cx, Handle<PromiseCombinatorDataHolder*> data,
|
||||
MutableHandle<PromiseCombinatorElements> elements)
|
||||
{
|
||||
@@ -2947,7 +2947,7 @@ PromiseCombinatorElementFunctionAlreadyCalled(const CallArgs& args,
|
||||
|
||||
// ES2020 draft rev a09fc232c137800dbf51b6204f37fdede4ba1646
|
||||
// 25.6.4.1.1 PerformPromiseAll (iteratorRecord, constructor, resultCapability)
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseAll(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done)
|
||||
{
|
||||
@@ -3083,7 +3083,7 @@ Promise_static_race(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
||||
// ES2020 draft rev a09fc232c137800dbf51b6204f37fdede4ba1646
|
||||
// 25.6.4.3.1 PerformPromiseRace (iteratorRecord, constructor, resultCapability)
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseRace(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done)
|
||||
{
|
||||
@@ -3138,7 +3138,7 @@ static bool Promise_static_allSettled(JSContext* cx, unsigned argc, Value* vp) {
|
||||
// 25.6.4.2 Promise.allSettled ( iterable )
|
||||
//
|
||||
// PerformPromiseAllSettled ( iteratorRecord, constructor, resultCapability )
|
||||
static MOZ_MUST_USE bool PerformPromiseAllSettled(
|
||||
[[nodiscard]] static bool PerformPromiseAllSettled(
|
||||
JSContext* cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done) {
|
||||
*done = false;
|
||||
@@ -3349,7 +3349,7 @@ static void ThrowAggregateError(JSContext* cx,
|
||||
// https://tc39.es/proposal-promise-any/
|
||||
//
|
||||
// PerformPromiseAny ( iteratorRecord, constructor, resultCapability )
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseAny(JSContext* cx, PromiseForOfIterator& iterator, HandleObject C,
|
||||
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done)
|
||||
{
|
||||
@@ -3553,7 +3553,7 @@ ThrowAggregateError(JSContext* cx, Handle<PromiseCombinatorElements> errors, Han
|
||||
// 25.6.4.4 Promise.reject ( r )
|
||||
// 25.6.4.5 Promise.resolve ( x )
|
||||
// 25.6.4.5.1 PromiseResolve ( C, x )
|
||||
static MOZ_MUST_USE JSObject*
|
||||
[[nodiscard]] static JSObject*
|
||||
CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue argVal,
|
||||
ResolutionMode mode)
|
||||
{
|
||||
@@ -3610,7 +3610,7 @@ CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue ar
|
||||
return capability.promise();
|
||||
}
|
||||
|
||||
MOZ_MUST_USE JSObject*
|
||||
[[nodiscard]] JSObject*
|
||||
js::PromiseResolve(JSContext* cx, HandleObject constructor, HandleValue value)
|
||||
{
|
||||
RootedValue C(cx, ObjectValue(*constructor));
|
||||
@@ -3789,7 +3789,7 @@ PromiseThenNewPromiseCapability(JSContext* cx, HandleObject promiseObj,
|
||||
}
|
||||
|
||||
// ES2016, 25.4.5.3., steps 3-5.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleValue onFulfilled, HandleValue onRejected,
|
||||
MutableHandleObject dependent, CreateDependentPromise createDependent)
|
||||
@@ -3813,7 +3813,7 @@ js::OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
return true;
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
OriginalPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
Handle<PromiseObject*> promiseToResolve)
|
||||
{
|
||||
@@ -3870,7 +3870,7 @@ OriginalPromiseThenBuiltin(JSContext* cx, HandleValue promiseVal, HandleValue on
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::RejectPromiseWithPendingError(JSContext* cx, Handle<PromiseObject*> promise)
|
||||
{
|
||||
// Not much we can do about uncatchable exceptions, just bail.
|
||||
@@ -3880,7 +3880,7 @@ js::RejectPromiseWithPendingError(JSContext* cx, Handle<PromiseObject*> promise)
|
||||
return PromiseObject::reject(cx, promise, exn);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool PerformPromiseThenWithReaction(JSContext* cx,
|
||||
[[nodiscard]] static bool PerformPromiseThenWithReaction(JSContext* cx,
|
||||
Handle<PromiseObject*> promise,
|
||||
Handle<PromiseReactionRecord*> reaction);
|
||||
|
||||
@@ -3888,7 +3888,7 @@ static MOZ_MUST_USE bool PerformPromiseThenWithReaction(JSContext* cx,
|
||||
// js/src/builtin/AsyncFunction.cpp, to call Promise internal functions.
|
||||
|
||||
// ES 2018 draft 14.6.11 and 14.7.14 step 1.
|
||||
MOZ_MUST_USE PromiseObject*
|
||||
[[nodiscard]] PromiseObject*
|
||||
js::CreatePromiseObjectForAsync(JSContext* cx, HandleValue generatorVal)
|
||||
{
|
||||
// Step 1.
|
||||
@@ -3909,7 +3909,7 @@ js::IsPromiseForAsync(JSObject* promise)
|
||||
}
|
||||
|
||||
// ES 2018 draft 25.5.5.2 steps 3.f, 3.g.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::AsyncFunctionThrown(JSContext* cx, Handle<PromiseObject*> resultPromise)
|
||||
{
|
||||
// Step 3.f.
|
||||
@@ -3925,7 +3925,7 @@ js::AsyncFunctionThrown(JSContext* cx, Handle<PromiseObject*> resultPromise)
|
||||
}
|
||||
|
||||
// ES 2018 draft 25.5.5.2 steps 3.d-e, 3.g.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::AsyncFunctionReturned(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value)
|
||||
{
|
||||
// Steps 3.d-e.
|
||||
@@ -3939,7 +3939,7 @@ js::AsyncFunctionReturned(JSContext* cx, Handle<PromiseObject*> resultPromise, H
|
||||
// Helper function that performs the equivalent steps as
|
||||
// Async Iteration proposal 4.1 Await steps 2-3, 6-9 or similar.
|
||||
template <typename T>
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
InternalAwait(JSContext* cx, HandleValue value, HandleObject resultPromise,
|
||||
HandleValue onFulfilled, HandleValue onRejected, T extraStep)
|
||||
{
|
||||
@@ -3972,7 +3972,7 @@ InternalAwait(JSContext* cx, HandleValue value, HandleObject resultPromise,
|
||||
}
|
||||
|
||||
// ES 2018 draft 25.5.5.3 steps 2-10.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value)
|
||||
{
|
||||
// Steps 4-5.
|
||||
@@ -3987,7 +3987,7 @@ js::AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, Hand
|
||||
}
|
||||
|
||||
// Async Iteration proposal 4.1 Await steps 2-9.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::AsyncGeneratorAwait(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
|
||||
HandleValue value)
|
||||
{
|
||||
@@ -4146,13 +4146,13 @@ enum class ResumeNextKind {
|
||||
Enqueue, Reject, Resolve
|
||||
};
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AsyncGeneratorResumeNext(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
|
||||
ResumeNextKind kind, HandleValue valueOrException = UndefinedHandleValue,
|
||||
bool done = false);
|
||||
|
||||
// Async Iteration proposal 11.4.3.3.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::AsyncGeneratorResolve(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
|
||||
HandleValue value, bool done)
|
||||
{
|
||||
@@ -4160,7 +4160,7 @@ js::AsyncGeneratorResolve(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenO
|
||||
}
|
||||
|
||||
// Async Iteration proposal 11.4.3.4.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::AsyncGeneratorReject(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
|
||||
HandleValue exception)
|
||||
{
|
||||
@@ -4168,7 +4168,7 @@ js::AsyncGeneratorReject(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenOb
|
||||
}
|
||||
|
||||
// Async Iteration proposal 11.4.3.5.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AsyncGeneratorResumeNext(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
|
||||
ResumeNextKind kind,
|
||||
HandleValue valueOrException_ /* = UndefinedHandleValue */,
|
||||
@@ -4349,7 +4349,7 @@ AsyncGeneratorResumeNext(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenOb
|
||||
}
|
||||
|
||||
// Async Iteration proposal 11.4.3.6.
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
js::AsyncGeneratorEnqueue(JSContext* cx, HandleValue asyncGenVal,
|
||||
CompletionKind completionKind, HandleValue completionValue,
|
||||
MutableHandleValue result)
|
||||
@@ -4540,7 +4540,7 @@ Promise_then(JSContext* cx, unsigned argc, Value* vp)
|
||||
}
|
||||
|
||||
// ES2016, 25.4.5.3.1.
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseThen(JSContext* cx, Handle<PromiseObject*> promise, HandleValue onFulfilled_,
|
||||
HandleValue onRejected_, Handle<PromiseCapability> resultCapability)
|
||||
{
|
||||
@@ -4567,7 +4567,7 @@ PerformPromiseThen(JSContext* cx, Handle<PromiseObject*> promise, HandleValue on
|
||||
return PerformPromiseThenWithReaction(cx, promise, reaction);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
Handle<PromiseObject*> promiseToResolve,
|
||||
Handle<PromiseCapability> resultCapability)
|
||||
@@ -4593,7 +4593,7 @@ PerformPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> pr
|
||||
return PerformPromiseThenWithReaction(cx, promise, reaction);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
PerformPromiseThenWithReaction(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
Handle<PromiseReactionRecord*> reaction)
|
||||
{
|
||||
@@ -4637,7 +4637,7 @@ PerformPromiseThenWithReaction(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
return true;
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AddPromiseReaction(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
Handle<PromiseReactionRecord*> reaction)
|
||||
{
|
||||
@@ -4705,7 +4705,7 @@ AddPromiseReaction(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
return true;
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool
|
||||
[[nodiscard]] static bool
|
||||
AddDummyPromiseReactionForDebugger(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleObject dependentPromise)
|
||||
{
|
||||
|
||||
+18
-18
@@ -73,10 +73,10 @@ class PromiseObject : public NativeObject
|
||||
return getFixedSlot(PromiseSlot_ReactionsOrResult);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool resolve(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleValue resolutionValue);
|
||||
static MOZ_MUST_USE bool reject(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleValue rejectionValue);
|
||||
[[nodiscard]] static bool resolve(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleValue resolutionValue);
|
||||
[[nodiscard]] static bool reject(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleValue rejectionValue);
|
||||
|
||||
static void onSettled(JSContext* cx, Handle<PromiseObject*> promise);
|
||||
|
||||
@@ -89,7 +89,7 @@ class PromiseObject : public NativeObject
|
||||
MOZ_ASSERT(state() != JS::PromiseState::Pending);
|
||||
return resolutionTime() - allocationTime();
|
||||
}
|
||||
MOZ_MUST_USE bool dependentPromises(JSContext* cx, MutableHandle<GCVector<Value>> values);
|
||||
[[nodiscard]] bool dependentPromises(JSContext* cx, MutableHandle<GCVector<Value>> values);
|
||||
uint64_t getID();
|
||||
bool isUnhandled() {
|
||||
MOZ_ASSERT(state() == JS::PromiseState::Rejected);
|
||||
@@ -113,7 +113,7 @@ class PromiseObject : public NativeObject
|
||||
* Asserts that all objects in the `promises` vector are, maybe wrapped,
|
||||
* instances of `Promise` or a subclass of `Promise`.
|
||||
*/
|
||||
MOZ_MUST_USE JSObject*
|
||||
[[nodiscard]] JSObject*
|
||||
GetWaitForAllPromise(JSContext* cx, const JS::AutoObjectVector& promises);
|
||||
|
||||
enum class CreateDependentPromise {
|
||||
@@ -132,7 +132,7 @@ enum class CreateDependentPromise {
|
||||
* `promise` field that can contain null. That field is only ever used by
|
||||
* devtools, which have to treat these reactions specially.
|
||||
*/
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
HandleValue onFulfilled, HandleValue onRejected,
|
||||
MutableHandleObject dependent, CreateDependentPromise createDependent);
|
||||
@@ -143,41 +143,41 @@ OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
|
||||
* The abstract operation PromiseResolve, given a constructor and a value,
|
||||
* returns a new promise resolved with that value.
|
||||
*/
|
||||
MOZ_MUST_USE JSObject*
|
||||
[[nodiscard]] JSObject*
|
||||
PromiseResolve(JSContext* cx, HandleObject constructor, HandleValue value);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
RejectPromiseWithPendingError(JSContext* cx, Handle<PromiseObject*> promise);
|
||||
|
||||
MOZ_MUST_USE PromiseObject*
|
||||
[[nodiscard]] PromiseObject*
|
||||
CreatePromiseObjectForAsync(JSContext* cx, HandleValue generatorVal);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
IsPromiseForAsync(JSObject* promise);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
AsyncFunctionReturned(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
AsyncFunctionThrown(JSContext* cx, Handle<PromiseObject*> resultPromise);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value);
|
||||
|
||||
class AsyncGeneratorObject;
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
AsyncGeneratorAwait(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj, HandleValue value);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
AsyncGeneratorResolve(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
|
||||
HandleValue value, bool done);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
AsyncGeneratorReject(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
|
||||
HandleValue exception);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
AsyncGeneratorEnqueue(JSContext* cx, HandleValue asyncGenVal, CompletionKind completionKind,
|
||||
HandleValue completionValue, MutableHandleValue result);
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ InitReflect(JSContext* cx, js::HandleObject obj);
|
||||
|
||||
namespace js {
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
Reflect_getPrototypeOf(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
Reflect_isExtensible(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ class NodeBuilder
|
||||
userv(c)
|
||||
{}
|
||||
|
||||
MOZ_MUST_USE bool init(HandleObject userobj = nullptr) {
|
||||
[[nodiscard]] bool init(HandleObject userobj = nullptr) {
|
||||
if (src) {
|
||||
if (!atomValue(src, &srcval))
|
||||
return false;
|
||||
@@ -307,7 +307,7 @@ class NodeBuilder
|
||||
}
|
||||
|
||||
private:
|
||||
MOZ_MUST_USE bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
|
||||
[[nodiscard]] bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
|
||||
TokenPos* pos, MutableHandleValue dst)
|
||||
{
|
||||
// The end of the implementation of callback(). All arguments except
|
||||
@@ -324,7 +324,7 @@ class NodeBuilder
|
||||
// that convert to HandleValue, so this isn't as template-y as it seems,
|
||||
// just variadic.
|
||||
template <typename... Arguments>
|
||||
MOZ_MUST_USE bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
|
||||
[[nodiscard]] bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
|
||||
HandleValue head, Arguments&&... tail)
|
||||
{
|
||||
// Recursive loop to store the arguments into args. This eventually
|
||||
@@ -338,7 +338,7 @@ class NodeBuilder
|
||||
// bool callback(HandleValue fun, HandleValue... args, TokenPos* pos,
|
||||
// MutableHandleValue dst);
|
||||
template <typename... Arguments>
|
||||
MOZ_MUST_USE bool callback(HandleValue fun, Arguments&&... args) {
|
||||
[[nodiscard]] bool callback(HandleValue fun, Arguments&&... args) {
|
||||
InvokeArgs iargs(cx);
|
||||
if (!iargs.init(cx, sizeof...(args) - 2 + size_t(saveLoc)))
|
||||
return false;
|
||||
@@ -355,7 +355,7 @@ class NodeBuilder
|
||||
return v.isMagic(JS_SERIALIZE_NO_NODE) ? JS::UndefinedHandleValue : v;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool atomValue(const char* s, MutableHandleValue dst) {
|
||||
[[nodiscard]] bool atomValue(const char* s, MutableHandleValue dst) {
|
||||
/*
|
||||
* Bug 575416: instead of Atomize, lookup constant atoms in tbl file
|
||||
*/
|
||||
@@ -367,7 +367,7 @@ class NodeBuilder
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool newObject(MutableHandleObject dst) {
|
||||
[[nodiscard]] bool newObject(MutableHandleObject dst) {
|
||||
RootedPlainObject nobj(cx, NewBuiltinClassInstance<PlainObject>(cx));
|
||||
if (!nobj)
|
||||
return false;
|
||||
@@ -376,11 +376,11 @@ class NodeBuilder
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool newArray(NodeVector& elts, MutableHandleValue dst);
|
||||
[[nodiscard]] bool newArray(NodeVector& elts, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool createNode(ASTType type, TokenPos* pos, MutableHandleObject dst);
|
||||
[[nodiscard]] bool createNode(ASTType type, TokenPos* pos, MutableHandleObject dst);
|
||||
|
||||
MOZ_MUST_USE bool newNodeHelper(HandleObject obj, MutableHandleValue dst) {
|
||||
[[nodiscard]] bool newNodeHelper(HandleObject obj, MutableHandleValue dst) {
|
||||
// The end of the implementation of newNode().
|
||||
MOZ_ASSERT(obj);
|
||||
dst.setObject(*obj);
|
||||
@@ -388,7 +388,7 @@ class NodeBuilder
|
||||
}
|
||||
|
||||
template <typename... Arguments>
|
||||
MOZ_MUST_USE bool newNodeHelper(HandleObject obj, const char *name, HandleValue value,
|
||||
[[nodiscard]] bool newNodeHelper(HandleObject obj, const char *name, HandleValue value,
|
||||
Arguments&&... rest)
|
||||
{
|
||||
// Recursive loop to define properties. Note that the newNodeHelper()
|
||||
@@ -407,13 +407,13 @@ class NodeBuilder
|
||||
// {const char *name0, HandleValue value0,}...
|
||||
// MutableHandleValue dst);
|
||||
template <typename... Arguments>
|
||||
MOZ_MUST_USE bool newNode(ASTType type, TokenPos* pos, Arguments&&... args) {
|
||||
[[nodiscard]] bool newNode(ASTType type, TokenPos* pos, Arguments&&... args) {
|
||||
RootedObject node(cx);
|
||||
return createNode(type, pos, &node) &&
|
||||
newNodeHelper(node, Forward<Arguments>(args)...);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool listNode(ASTType type, const char* propName, NodeVector& elts, TokenPos* pos,
|
||||
[[nodiscard]] bool listNode(ASTType type, const char* propName, NodeVector& elts, TokenPos* pos,
|
||||
MutableHandleValue dst) {
|
||||
RootedValue array(cx);
|
||||
if (!newArray(elts, &array))
|
||||
@@ -426,7 +426,7 @@ class NodeBuilder
|
||||
return newNode(type, pos, propName, array, dst);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool defineProperty(HandleObject obj, const char* name, HandleValue val) {
|
||||
[[nodiscard]] bool defineProperty(HandleObject obj, const char* name, HandleValue val) {
|
||||
MOZ_ASSERT_IF(val.isMagic(), val.whyMagic() == JS_SERIALIZE_NO_NODE);
|
||||
|
||||
/*
|
||||
@@ -441,9 +441,9 @@ class NodeBuilder
|
||||
return DefineProperty(cx, obj, atom->asPropertyName(), optVal);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool newNodeLoc(TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool newNodeLoc(TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool setNodeLoc(HandleObject node, TokenPos* pos);
|
||||
[[nodiscard]] bool setNodeLoc(HandleObject node, TokenPos* pos);
|
||||
|
||||
public:
|
||||
/*
|
||||
@@ -459,27 +459,27 @@ class NodeBuilder
|
||||
* misc nodes
|
||||
*/
|
||||
|
||||
MOZ_MUST_USE bool program(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool program(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool literal(HandleValue val, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool literal(HandleValue val, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool identifier(HandleValue name, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool identifier(HandleValue name, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool function(ASTType type, TokenPos* pos,
|
||||
[[nodiscard]] bool function(ASTType type, TokenPos* pos,
|
||||
HandleValue id, NodeVector& args, NodeVector& defaults,
|
||||
HandleValue body, HandleValue rest, GeneratorStyle generatorStyle,
|
||||
bool isAsync, bool isExpression, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool variableDeclarator(HandleValue id, HandleValue init, TokenPos* pos,
|
||||
[[nodiscard]] bool variableDeclarator(HandleValue id, HandleValue init, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool switchCase(HandleValue expr, NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool switchCase(HandleValue expr, NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool catchClause(HandleValue var, HandleValue guard, HandleValue body, TokenPos* pos,
|
||||
[[nodiscard]] bool catchClause(HandleValue var, HandleValue guard, HandleValue body, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool prototypeMutation(HandleValue val, TokenPos* pos, MutableHandleValue dst);
|
||||
MOZ_MUST_USE bool propertyInitializer(HandleValue key, HandleValue val, PropKind kind,
|
||||
[[nodiscard]] bool prototypeMutation(HandleValue val, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool propertyInitializer(HandleValue key, HandleValue val, PropKind kind,
|
||||
bool isShorthand, bool isMethod, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
@@ -488,165 +488,165 @@ class NodeBuilder
|
||||
* statements
|
||||
*/
|
||||
|
||||
MOZ_MUST_USE bool blockStatement(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool blockStatement(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool expressionStatement(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool expressionStatement(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool emptyStatement(TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool emptyStatement(TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool ifStatement(HandleValue test, HandleValue cons, HandleValue alt, TokenPos* pos,
|
||||
[[nodiscard]] bool ifStatement(HandleValue test, HandleValue cons, HandleValue alt, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool breakStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool breakStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool continueStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool continueStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool labeledStatement(HandleValue label, HandleValue stmt, TokenPos* pos,
|
||||
[[nodiscard]] bool labeledStatement(HandleValue label, HandleValue stmt, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool throwStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool throwStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool returnStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool returnStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool forStatement(HandleValue init, HandleValue test, HandleValue update, HandleValue stmt,
|
||||
[[nodiscard]] bool forStatement(HandleValue init, HandleValue test, HandleValue update, HandleValue stmt,
|
||||
TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool forInStatement(HandleValue var, HandleValue expr, HandleValue stmt,
|
||||
[[nodiscard]] bool forInStatement(HandleValue var, HandleValue expr, HandleValue stmt,
|
||||
bool isForEach, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool forOfStatement(HandleValue var, HandleValue expr, HandleValue stmt, TokenPos* pos,
|
||||
[[nodiscard]] bool forOfStatement(HandleValue var, HandleValue expr, HandleValue stmt, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool withStatement(HandleValue expr, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool withStatement(HandleValue expr, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool whileStatement(HandleValue test, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool whileStatement(HandleValue test, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool doWhileStatement(HandleValue stmt, HandleValue test, TokenPos* pos,
|
||||
[[nodiscard]] bool doWhileStatement(HandleValue stmt, HandleValue test, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool switchStatement(HandleValue disc, NodeVector& elts, bool lexical, TokenPos* pos,
|
||||
[[nodiscard]] bool switchStatement(HandleValue disc, NodeVector& elts, bool lexical, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool tryStatement(HandleValue body, NodeVector& guarded, HandleValue unguarded,
|
||||
[[nodiscard]] bool tryStatement(HandleValue body, NodeVector& guarded, HandleValue unguarded,
|
||||
HandleValue finally, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool debuggerStatement(TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool debuggerStatement(TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool importDeclaration(NodeVector& elts, HandleValue moduleSpec, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool importDeclaration(NodeVector& elts, HandleValue moduleSpec, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool importSpecifier(HandleValue importName, HandleValue bindingName, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool importSpecifier(HandleValue importName, HandleValue bindingName, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool exportDeclaration(HandleValue decl, NodeVector& elts, HandleValue moduleSpec,
|
||||
[[nodiscard]] bool exportDeclaration(HandleValue decl, NodeVector& elts, HandleValue moduleSpec,
|
||||
HandleValue isDefault, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool exportSpecifier(HandleValue bindingName, HandleValue exportName, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool exportSpecifier(HandleValue bindingName, HandleValue exportName, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool exportBatchSpecifier(TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool exportBatchSpecifier(TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool classDefinition(bool expr, HandleValue name, HandleValue heritage,
|
||||
[[nodiscard]] bool classDefinition(bool expr, HandleValue name, HandleValue heritage,
|
||||
HandleValue block, TokenPos* pos, MutableHandleValue dst);
|
||||
MOZ_MUST_USE bool classMembers(NodeVector& members, MutableHandleValue dst);
|
||||
MOZ_MUST_USE bool classMethod(HandleValue name, HandleValue body, PropKind kind, bool isStatic,
|
||||
[[nodiscard]] bool classMembers(NodeVector& members, MutableHandleValue dst);
|
||||
[[nodiscard]] bool classMethod(HandleValue name, HandleValue body, PropKind kind, bool isStatic,
|
||||
TokenPos* pos, MutableHandleValue dst);
|
||||
MOZ_MUST_USE bool classField(HandleValue name, HandleValue initializer,
|
||||
[[nodiscard]] bool classField(HandleValue name, HandleValue initializer,
|
||||
TokenPos* pos, MutableHandleValue dst);
|
||||
MOZ_MUST_USE bool staticClassBlock(HandleValue body, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool staticClassBlock(HandleValue body, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
/*
|
||||
* expressions
|
||||
*/
|
||||
|
||||
MOZ_MUST_USE bool binaryExpression(BinaryOperator op, HandleValue left, HandleValue right,
|
||||
[[nodiscard]] bool binaryExpression(BinaryOperator op, HandleValue left, HandleValue right,
|
||||
TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool unaryExpression(UnaryOperator op, HandleValue expr, TokenPos* pos,
|
||||
[[nodiscard]] bool unaryExpression(UnaryOperator op, HandleValue expr, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool assignmentExpression(AssignmentOperator op, HandleValue lhs, HandleValue rhs,
|
||||
[[nodiscard]] bool assignmentExpression(AssignmentOperator op, HandleValue lhs, HandleValue rhs,
|
||||
TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool updateExpression(HandleValue expr, bool incr, bool prefix, TokenPos* pos,
|
||||
[[nodiscard]] bool updateExpression(HandleValue expr, bool incr, bool prefix, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool logicalExpression(ParseNodeKind kind, HandleValue left, HandleValue right, TokenPos* pos,
|
||||
[[nodiscard]] bool logicalExpression(ParseNodeKind kind, HandleValue left, HandleValue right, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool conditionalExpression(HandleValue test, HandleValue cons, HandleValue alt,
|
||||
[[nodiscard]] bool conditionalExpression(HandleValue test, HandleValue cons, HandleValue alt,
|
||||
TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool sequenceExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool sequenceExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool newExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
|
||||
[[nodiscard]] bool newExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool callExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
|
||||
[[nodiscard]] bool callExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
|
||||
MutableHandleValue dst, bool isOptional = false);
|
||||
|
||||
MOZ_MUST_USE bool memberExpression(bool computed, HandleValue expr, HandleValue member,
|
||||
[[nodiscard]] bool memberExpression(bool computed, HandleValue expr, HandleValue member,
|
||||
TokenPos* pos, MutableHandleValue dst,
|
||||
bool isOptional = false);
|
||||
|
||||
MOZ_MUST_USE bool arrayExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool arrayExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool templateLiteral(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool templateLiteral(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool taggedTemplate(HandleValue callee, NodeVector& args, TokenPos* pos,
|
||||
[[nodiscard]] bool taggedTemplate(HandleValue callee, NodeVector& args, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool callSiteObj(NodeVector& raw, NodeVector& cooked, TokenPos* pos,
|
||||
[[nodiscard]] bool callSiteObj(NodeVector& raw, NodeVector& cooked, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool spreadExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool spreadExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool optionalExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool optionalExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool deleteOptionalExpression(HandleValue expr, TokenPos* pos,
|
||||
[[nodiscard]] bool deleteOptionalExpression(HandleValue expr, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool computedName(HandleValue name, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool computedName(HandleValue name, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool objectExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool objectExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool thisExpression(TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool thisExpression(TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool yieldExpression(HandleValue arg, YieldKind kind, TokenPos* pos,
|
||||
[[nodiscard]] bool yieldExpression(HandleValue arg, YieldKind kind, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool comprehensionBlock(HandleValue patt, HandleValue src, bool isForEach,
|
||||
[[nodiscard]] bool comprehensionBlock(HandleValue patt, HandleValue src, bool isForEach,
|
||||
bool isForOf, TokenPos* pos, MutableHandleValue dst);
|
||||
MOZ_MUST_USE bool comprehensionIf(HandleValue test, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool comprehensionIf(HandleValue test, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool comprehensionExpression(HandleValue body, NodeVector& blocks,
|
||||
[[nodiscard]] bool comprehensionExpression(HandleValue body, NodeVector& blocks,
|
||||
HandleValue filter, bool isLegacy, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool generatorExpression(HandleValue body, NodeVector& blocks, HandleValue filter,
|
||||
[[nodiscard]] bool generatorExpression(HandleValue body, NodeVector& blocks, HandleValue filter,
|
||||
bool isLegacy, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool metaProperty(HandleValue meta, HandleValue property, TokenPos* pos,
|
||||
[[nodiscard]] bool metaProperty(HandleValue meta, HandleValue property, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool callImportExpression(HandleValue ident, HandleValue arg, TokenPos* pos,
|
||||
[[nodiscard]] bool callImportExpression(HandleValue ident, HandleValue arg, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool super(TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool super(TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
/*
|
||||
* declarations
|
||||
*/
|
||||
|
||||
MOZ_MUST_USE bool variableDeclaration(NodeVector& elts, VarDeclKind kind, TokenPos* pos,
|
||||
[[nodiscard]] bool variableDeclaration(NodeVector& elts, VarDeclKind kind, TokenPos* pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
/*
|
||||
* patterns
|
||||
*/
|
||||
|
||||
MOZ_MUST_USE bool arrayPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool arrayPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool objectPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
[[nodiscard]] bool objectPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
|
||||
|
||||
MOZ_MUST_USE bool propertyPattern(HandleValue key, HandleValue patt, bool isShorthand,
|
||||
[[nodiscard]] bool propertyPattern(HandleValue key, HandleValue patt, bool isShorthand,
|
||||
TokenPos* pos, MutableHandleValue dst);
|
||||
};
|
||||
|
||||
|
||||
+28
-28
@@ -25,42 +25,42 @@ InitRegExpClass(JSContext* cx, HandleObject obj);
|
||||
* |input| may be nullptr if there is no JSString corresponding to
|
||||
* |chars| and |length|.
|
||||
*/
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
ExecuteRegExpLegacy(JSContext* cx, RegExpStatics* res, Handle<RegExpObject*> reobj,
|
||||
HandleLinearString input, size_t* lastIndex, bool test,
|
||||
MutableHandleValue rval);
|
||||
|
||||
/* Translation from MatchPairs to a JS array in regexp_exec()'s output format. */
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
CreateRegExpMatchResult(JSContext* cx, RegExpShared& re,
|
||||
HandleString input, const MatchPairs& matches,
|
||||
MutableHandleValue rval);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpMatcher(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpMatcherRaw(JSContext* cx, HandleObject regexp, HandleString input,
|
||||
int32_t lastIndex, MatchPairs* maybeMatches, MutableHandleValue output);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpSearcher(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpSearcherRaw(JSContext* cx, HandleObject regexp, HandleString input,
|
||||
int32_t lastIndex, MatchPairs* maybeMatches, int32_t* result);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpTester(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpTesterRaw(JSContext* cx, HandleObject regexp, HandleString input,
|
||||
int32_t lastIndex, int32_t* endIndex);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intrinsic_GetElemBaseForLambda(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intrinsic_GetStringDataProperty(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
@@ -73,67 +73,67 @@ intrinsic_GetStringDataProperty(JSContext* cx, unsigned argc, Value* vp);
|
||||
* Must be called without |new|.
|
||||
* Dedicated function for RegExp.prototype[@@split] optimized path.
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_construct_raw_flags(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Clone given RegExp object, inheriting pattern and flags, ignoring other
|
||||
* properties.
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_clone(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
IsRegExp(JSContext* cx, HandleValue value, bool* result);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpCreate(JSContext* cx, HandleValue pattern, HandleValue flags, MutableHandleValue rval);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpPrototypeOptimizable(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpPrototypeOptimizableRaw(JSContext* cx, JSObject* proto);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpInstanceOptimizable(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpInstanceOptimizableRaw(JSContext* cx, JSObject* obj, JSObject* proto);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
RegExpGetSubstitution(JSContext* cx, HandleArrayObject matchResult, HandleLinearString string,
|
||||
size_t position, HandleLinearString replacement, size_t firstDollarIndex,
|
||||
HandleValue namedCaptures, MutableHandleValue rval);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
GetFirstDollarIndex(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
GetFirstDollarIndexRaw(JSContext* cx, HandleString str, int32_t* index);
|
||||
|
||||
extern int32_t
|
||||
GetFirstDollarIndexRawFlat(JSLinearString* text);
|
||||
|
||||
// RegExp ClassSpec members used in RegExpObject.cpp.
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
extern const JSPropertySpec regexp_static_props[];
|
||||
extern const JSPropertySpec regexp_properties[];
|
||||
extern const JSFunctionSpec regexp_methods[];
|
||||
|
||||
// Used in RegExpObject::isOriginalFlagGetter.
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_global(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_ignoreCase(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_multiline(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_sticky(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_unicode(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
regexp_dotAll(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
+147
-147
File diff suppressed because it is too large.
Load diff
+26
-26
@@ -37,31 +37,31 @@ class ReadableStream : public NativeObject
|
||||
|
||||
JS::ReadableStreamMode mode() const;
|
||||
|
||||
static MOZ_MUST_USE bool close(JSContext* cx, Handle<ReadableStream*> stream);
|
||||
static MOZ_MUST_USE JSObject* cancel(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
HandleValue reason);
|
||||
static MOZ_MUST_USE bool error(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
HandleValue error);
|
||||
[[nodiscard]] static bool close(JSContext* cx, Handle<ReadableStream*> stream);
|
||||
[[nodiscard]] static JSObject* cancel(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
HandleValue reason);
|
||||
[[nodiscard]] static bool error(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
HandleValue error);
|
||||
|
||||
static MOZ_MUST_USE NativeObject* getReader(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
JS::ReadableStreamReaderMode mode);
|
||||
[[nodiscard]] static NativeObject* getReader(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
JS::ReadableStreamReaderMode mode);
|
||||
|
||||
static MOZ_MUST_USE bool tee(JSContext* cx,
|
||||
Handle<ReadableStream*> stream, bool cloneForBranch2,
|
||||
MutableHandle<ReadableStream*> branch1Stream,
|
||||
MutableHandle<ReadableStream*> branch2Stream);
|
||||
[[nodiscard]] static bool tee(JSContext* cx,
|
||||
Handle<ReadableStream*> stream, bool cloneForBranch2,
|
||||
MutableHandle<ReadableStream*> branch1Stream,
|
||||
MutableHandle<ReadableStream*> branch2Stream);
|
||||
|
||||
static MOZ_MUST_USE bool enqueue(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
HandleValue chunk);
|
||||
static MOZ_MUST_USE bool enqueueBuffer(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
Handle<ArrayBufferObject*> chunk);
|
||||
static MOZ_MUST_USE bool getExternalSource(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
void** source);
|
||||
[[nodiscard]] static bool enqueue(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
HandleValue chunk);
|
||||
[[nodiscard]] static bool enqueueBuffer(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
Handle<ArrayBufferObject*> chunk);
|
||||
[[nodiscard]] static bool getExternalSource(JSContext* cx, Handle<ReadableStream*> stream,
|
||||
void** source);
|
||||
void releaseExternalSource();
|
||||
uint8_t embeddingFlags() const;
|
||||
static MOZ_MUST_USE bool updateDataAvailableFromSource(JSContext* cx,
|
||||
Handle<ReadableStream*> stream,
|
||||
uint32_t availableData);
|
||||
[[nodiscard]] static bool updateDataAvailableFromSource(JSContext* cx,
|
||||
Handle<ReadableStream*> stream,
|
||||
uint32_t availableData);
|
||||
|
||||
enum State {
|
||||
Readable = 1 << 0,
|
||||
@@ -71,7 +71,7 @@ class ReadableStream : public NativeObject
|
||||
};
|
||||
|
||||
private:
|
||||
static MOZ_MUST_USE ReadableStream* createStream(JSContext* cx, HandleObject proto = nullptr);
|
||||
[[nodiscard]] static ReadableStream* createStream(JSContext* cx, HandleObject proto = nullptr);
|
||||
|
||||
public:
|
||||
static bool constructor(JSContext* cx, unsigned argc, Value* vp);
|
||||
@@ -84,7 +84,7 @@ class ReadableStream : public NativeObject
|
||||
class ReadableStreamDefaultReader : public NativeObject
|
||||
{
|
||||
public:
|
||||
static MOZ_MUST_USE JSObject* read(JSContext* cx, Handle<ReadableStreamDefaultReader*> reader);
|
||||
[[nodiscard]] static JSObject* read(JSContext* cx, Handle<ReadableStreamDefaultReader*> reader);
|
||||
|
||||
static bool constructor(JSContext* cx, unsigned argc, Value* vp);
|
||||
static const ClassSpec classSpec_;
|
||||
@@ -96,8 +96,8 @@ class ReadableStreamDefaultReader : public NativeObject
|
||||
class ReadableStreamBYOBReader : public NativeObject
|
||||
{
|
||||
public:
|
||||
static MOZ_MUST_USE JSObject* read(JSContext* cx, Handle<ReadableStreamBYOBReader*> reader,
|
||||
Handle<ArrayBufferViewObject*> view);
|
||||
[[nodiscard]] static JSObject* read(JSContext* cx, Handle<ReadableStreamBYOBReader*> reader,
|
||||
Handle<ArrayBufferViewObject*> view);
|
||||
|
||||
static bool constructor(JSContext* cx, unsigned argc, Value* vp);
|
||||
static const ClassSpec classSpec_;
|
||||
@@ -108,10 +108,10 @@ class ReadableStreamBYOBReader : public NativeObject
|
||||
|
||||
bool ReadableStreamReaderIsClosed(const JSObject* reader);
|
||||
|
||||
MOZ_MUST_USE bool ReadableStreamReaderCancel(JSContext* cx, HandleObject reader,
|
||||
[[nodiscard]] bool ReadableStreamReaderCancel(JSContext* cx, HandleObject reader,
|
||||
HandleValue reason);
|
||||
|
||||
MOZ_MUST_USE bool ReadableStreamReaderReleaseLock(JSContext* cx, HandleObject reader);
|
||||
[[nodiscard]] bool ReadableStreamReaderReleaseLock(JSContext* cx, HandleObject reader);
|
||||
|
||||
class ReadableStreamDefaultController : public NativeObject
|
||||
{
|
||||
|
||||
@@ -38,22 +38,22 @@ class SymbolObject : public NativeObject
|
||||
setFixedSlot(PRIMITIVE_VALUE_SLOT, SymbolValue(symbol));
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
static [[nodiscard]] bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
// Static methods.
|
||||
static MOZ_MUST_USE bool for_(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool keyFor(JSContext* cx, unsigned argc, Value* vp);
|
||||
static [[nodiscard]] bool for_(JSContext* cx, unsigned argc, Value* vp);
|
||||
static [[nodiscard]] bool keyFor(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
// Methods defined on Symbol.prototype.
|
||||
static MOZ_MUST_USE bool toString_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool toString(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool valueOf_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool valueOf(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool toPrimitive(JSContext* cx, unsigned argc, Value* vp);
|
||||
static [[nodiscard]] bool toString_impl(JSContext* cx, const CallArgs& args);
|
||||
static [[nodiscard]] bool toString(JSContext* cx, unsigned argc, Value* vp);
|
||||
static [[nodiscard]] bool valueOf_impl(JSContext* cx, const CallArgs& args);
|
||||
static [[nodiscard]] bool valueOf(JSContext* cx, unsigned argc, Value* vp);
|
||||
static [[nodiscard]] bool toPrimitive(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
// Properties defined on Symbol.prototype.
|
||||
static MOZ_MUST_USE bool descriptionGetter_impl(JSContext* cx, const CallArgs& args);
|
||||
static MOZ_MUST_USE bool descriptionGetter(JSContext* cx, unsigned argc, Value *vp);
|
||||
static [[nodiscard]] bool descriptionGetter_impl(JSContext* cx, const CallArgs& args);
|
||||
static [[nodiscard]] bool descriptionGetter(JSContext* cx, unsigned argc, Value *vp);
|
||||
|
||||
static const JSPropertySpec properties[];
|
||||
static const JSFunctionSpec methods[];
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
namespace js {
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe, bool disableOOMFunctions);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
testingFunc_assertFloat32(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
testingFunc_assertRecoveredOnBailout(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
@@ -176,7 +176,7 @@ class TypeDescr : public NativeObject
|
||||
}
|
||||
|
||||
// Whether id is an 'own' property of objects with this descriptor.
|
||||
MOZ_MUST_USE bool hasProperty(const JSAtomState& names, jsid id);
|
||||
[[nodiscard]] bool hasProperty(const JSAtomState& names, jsid id);
|
||||
|
||||
// Type descriptors may contain a list of their references for use during
|
||||
// scanning. Marking code is optimized to use this list to mark inline
|
||||
@@ -188,7 +188,7 @@ class TypeDescr : public NativeObject
|
||||
// The list is three consecutive arrays of int32_t offsets, with each array
|
||||
// terminated by -1. The arrays store offsets of string, object, and value
|
||||
// references in the descriptor, in that order.
|
||||
MOZ_MUST_USE bool hasTraceList() const {
|
||||
[[nodiscard]] bool hasTraceList() const {
|
||||
return !getFixedSlot(JS_DESCR_SLOT_TRACE_LIST).isUndefined();
|
||||
}
|
||||
const int32_t* traceList() const {
|
||||
@@ -257,7 +257,7 @@ class ScalarTypeDescr : public SimpleTypeDescr
|
||||
return Type(getReservedSlot(JS_DESCR_SLOT_TYPE).toInt32());
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool call(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool call(JSContext* cx, unsigned argc, Value* vp);
|
||||
};
|
||||
|
||||
// Enumerates the cases of ScalarTypeDescr::Type which have
|
||||
@@ -310,7 +310,7 @@ class ReferenceTypeDescr : public SimpleTypeDescr
|
||||
return typeName(type());
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool call(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool call(JSContext* cx, unsigned argc, Value* vp);
|
||||
};
|
||||
|
||||
#define JS_FOR_EACH_REFERENCE_TYPE_REPR(macro_) \
|
||||
@@ -333,7 +333,7 @@ class ComplexTypeDescr : public TypeDescr
|
||||
bool IsTypedObjectClass(const Class* clasp); // Defined below
|
||||
bool IsTypedObjectArray(JSObject& obj);
|
||||
|
||||
MOZ_MUST_USE bool CreateUserSizeAndAlignmentProperties(JSContext* cx, HandleTypeDescr obj);
|
||||
[[nodiscard]] bool CreateUserSizeAndAlignmentProperties(JSContext* cx, HandleTypeDescr obj);
|
||||
|
||||
class ArrayTypeDescr;
|
||||
|
||||
@@ -371,7 +371,7 @@ class ArrayMetaTypeDescr : public NativeObject
|
||||
|
||||
// This is the function that gets called when the user
|
||||
// does `new ArrayType(elem)`. It produces an array type object.
|
||||
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -422,7 +422,7 @@ class StructMetaTypeDescr : public NativeObject
|
||||
|
||||
// This is the function that gets called when the user
|
||||
// does `new StructType(...)`. It produces a struct type object.
|
||||
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
};
|
||||
|
||||
class StructTypeDescr : public ComplexTypeDescr
|
||||
@@ -435,7 +435,7 @@ class StructTypeDescr : public ComplexTypeDescr
|
||||
|
||||
// Set `*out` to the index of the field named `id` and returns true,
|
||||
// or return false if no such field exists.
|
||||
MOZ_MUST_USE bool fieldIndex(jsid id, size_t* out) const;
|
||||
[[nodiscard]] bool fieldIndex(jsid id, size_t* out) const;
|
||||
|
||||
// Return the name of the field at index `index`.
|
||||
JSAtom& fieldName(size_t index) const;
|
||||
@@ -475,45 +475,45 @@ class TypedObject : public ShapedObject
|
||||
{
|
||||
static const bool IsTypedObjectClass = true;
|
||||
|
||||
static MOZ_MUST_USE bool obj_getArrayElement(JSContext* cx,
|
||||
Handle<TypedObject*> typedObj,
|
||||
Handle<TypeDescr*> typeDescr,
|
||||
uint32_t index,
|
||||
MutableHandleValue vp);
|
||||
[[nodiscard]] static bool obj_getArrayElement(JSContext* cx,
|
||||
Handle<TypedObject*> typedObj,
|
||||
Handle<TypeDescr*> typeDescr,
|
||||
uint32_t index,
|
||||
MutableHandleValue vp);
|
||||
|
||||
protected:
|
||||
static const ObjectOps objectOps_;
|
||||
|
||||
static MOZ_MUST_USE bool obj_lookupProperty(JSContext* cx, HandleObject obj,
|
||||
HandleId id, MutableHandleObject objp,
|
||||
MutableHandle<PropertyResult> propp);
|
||||
[[nodiscard]] static bool obj_lookupProperty(JSContext* cx, HandleObject obj,
|
||||
HandleId id, MutableHandleObject objp,
|
||||
MutableHandle<PropertyResult> propp);
|
||||
|
||||
static MOZ_MUST_USE bool obj_defineProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
Handle<PropertyDescriptor> desc,
|
||||
ObjectOpResult& result);
|
||||
[[nodiscard]] static bool obj_defineProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
Handle<PropertyDescriptor> desc,
|
||||
ObjectOpResult& result);
|
||||
|
||||
static MOZ_MUST_USE bool obj_hasProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
bool* foundp);
|
||||
[[nodiscard]] static bool obj_hasProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
bool* foundp);
|
||||
|
||||
static MOZ_MUST_USE bool obj_getProperty(JSContext* cx, HandleObject obj, HandleValue receiver,
|
||||
HandleId id, MutableHandleValue vp);
|
||||
[[nodiscard]] static bool obj_getProperty(JSContext* cx, HandleObject obj, HandleValue receiver,
|
||||
HandleId id, MutableHandleValue vp);
|
||||
|
||||
static MOZ_MUST_USE bool obj_getElement(JSContext* cx, HandleObject obj, HandleValue receiver,
|
||||
uint32_t index, MutableHandleValue vp);
|
||||
[[nodiscard]] static bool obj_getElement(JSContext* cx, HandleObject obj, HandleValue receiver,
|
||||
uint32_t index, MutableHandleValue vp);
|
||||
|
||||
static MOZ_MUST_USE bool obj_setProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
HandleValue v, HandleValue receiver,
|
||||
ObjectOpResult& result);
|
||||
[[nodiscard]] static bool obj_setProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
HandleValue v, HandleValue receiver,
|
||||
ObjectOpResult& result);
|
||||
|
||||
static MOZ_MUST_USE bool obj_getOwnPropertyDescriptor(JSContext* cx, HandleObject obj,
|
||||
HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc);
|
||||
[[nodiscard]] static bool obj_getOwnPropertyDescriptor(JSContext* cx, HandleObject obj,
|
||||
HandleId id,
|
||||
MutableHandle<PropertyDescriptor> desc);
|
||||
|
||||
static MOZ_MUST_USE bool obj_deleteProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
ObjectOpResult& result);
|
||||
[[nodiscard]] static bool obj_deleteProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
ObjectOpResult& result);
|
||||
|
||||
static MOZ_MUST_USE bool obj_enumerate(JSContext* cx, HandleObject obj,
|
||||
AutoIdVector& properties, bool enumerableOnly);
|
||||
[[nodiscard]] static bool obj_enumerate(JSContext* cx, HandleObject obj,
|
||||
AutoIdVector& properties, bool enumerableOnly);
|
||||
|
||||
|
||||
uint8_t* typedMem() const;
|
||||
@@ -548,7 +548,7 @@ class TypedObject : public ShapedObject
|
||||
return typedMem(nogc) + offset;
|
||||
}
|
||||
|
||||
inline MOZ_MUST_USE bool opaque() const;
|
||||
[[nodiscard]] inline bool opaque() const;
|
||||
|
||||
// Creates a new typed object whose memory is freshly allocated and
|
||||
// initialized with zeroes (or, in the case of references, an appropriate
|
||||
@@ -558,11 +558,11 @@ class TypedObject : public ShapedObject
|
||||
|
||||
// User-accessible constructor (`new TypeDescriptor(...)`). Note that the
|
||||
// callee here is the type descriptor.
|
||||
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/* Accessors for self hosted code. */
|
||||
static MOZ_MUST_USE bool GetBuffer(JSContext* cx, unsigned argc, Value* vp);
|
||||
static MOZ_MUST_USE bool GetByteOffset(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool GetBuffer(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool GetByteOffset(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
Shape** addressOfShapeFromGC() { return shape_.unsafeUnbarrieredForTracing(); }
|
||||
};
|
||||
@@ -733,14 +733,14 @@ class InlineOpaqueTypedObject : public InlineTypedObject
|
||||
*
|
||||
* Constructs a new, unattached instance of `Handle`.
|
||||
*/
|
||||
MOZ_MUST_USE bool NewOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool NewOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: NewDerivedTypedObject(typeObj, owner, offset)
|
||||
*
|
||||
* Constructs a new, unattached instance of `Handle`.
|
||||
*/
|
||||
MOZ_MUST_USE bool NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: AttachTypedObject(typedObj, newDatum, newOffset)
|
||||
@@ -748,7 +748,7 @@ MOZ_MUST_USE bool NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp)
|
||||
* Moves `typedObj` to point at the memory referenced by `newDatum` with
|
||||
* the offset `newOffset`.
|
||||
*/
|
||||
MOZ_MUST_USE bool AttachTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool AttachTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: SetTypedObjectOffset(typedObj, offset)
|
||||
@@ -756,41 +756,41 @@ MOZ_MUST_USE bool AttachTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
* Changes the offset for `typedObj` within its buffer to `offset`.
|
||||
* `typedObj` must already be attached.
|
||||
*/
|
||||
MOZ_MUST_USE bool SetTypedObjectOffset(JSContext*, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool SetTypedObjectOffset(JSContext*, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: ObjectIsTypeDescr(obj)
|
||||
*
|
||||
* True if `obj` is a type object.
|
||||
*/
|
||||
MOZ_MUST_USE bool ObjectIsTypeDescr(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool ObjectIsTypeDescr(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: ObjectIsTypedObject(obj)
|
||||
*
|
||||
* True if `obj` is a transparent or opaque typed object.
|
||||
*/
|
||||
MOZ_MUST_USE bool ObjectIsTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool ObjectIsTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: ObjectIsOpaqueTypedObject(obj)
|
||||
*
|
||||
* True if `obj` is an opaque typed object.
|
||||
*/
|
||||
MOZ_MUST_USE bool ObjectIsOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool ObjectIsOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: ObjectIsTransparentTypedObject(obj)
|
||||
*
|
||||
* True if `obj` is a transparent typed object.
|
||||
*/
|
||||
MOZ_MUST_USE bool ObjectIsTransparentTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool ObjectIsTransparentTypedObject(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/* Predicates on type descriptor objects. In all cases, 'obj' must be a type descriptor. */
|
||||
|
||||
MOZ_MUST_USE bool TypeDescrIsSimpleType(JSContext*, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool TypeDescrIsSimpleType(JSContext*, unsigned argc, Value* vp);
|
||||
|
||||
MOZ_MUST_USE bool TypeDescrIsArrayType(JSContext*, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool TypeDescrIsArrayType(JSContext*, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: TypedObjectIsAttached(obj)
|
||||
@@ -798,21 +798,21 @@ MOZ_MUST_USE bool TypeDescrIsArrayType(JSContext*, unsigned argc, Value* vp);
|
||||
* Given a TypedObject `obj`, returns true if `obj` is
|
||||
* "attached" (i.e., its data pointer is nullptr).
|
||||
*/
|
||||
MOZ_MUST_USE bool TypedObjectIsAttached(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool TypedObjectIsAttached(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: TypedObjectTypeDescr(obj)
|
||||
*
|
||||
* Given a TypedObject `obj`, returns the object's type descriptor.
|
||||
*/
|
||||
MOZ_MUST_USE bool TypedObjectTypeDescr(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool TypedObjectTypeDescr(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: ClampToUint8(v)
|
||||
*
|
||||
* Same as the C function ClampDoubleToUint8. `v` must be a number.
|
||||
*/
|
||||
MOZ_MUST_USE bool ClampToUint8(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool ClampToUint8(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: GetTypedObjectModule()
|
||||
@@ -823,7 +823,7 @@ MOZ_MUST_USE bool ClampToUint8(JSContext* cx, unsigned argc, Value* vp);
|
||||
* to access them; eventually this should be linked into the module
|
||||
* system.
|
||||
*/
|
||||
MOZ_MUST_USE bool GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/*
|
||||
* Usage: Store_int8(targetDatum, targetOffset, value)
|
||||
@@ -844,7 +844,7 @@ MOZ_MUST_USE bool GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp);
|
||||
#define JS_STORE_SCALAR_CLASS_DEFN(_constant, T, _name) \
|
||||
class StoreScalar##T { \
|
||||
public: \
|
||||
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
static const JSJitInfo JitInfo; \
|
||||
};
|
||||
|
||||
@@ -864,11 +864,11 @@ class StoreScalar##T { \
|
||||
#define JS_STORE_REFERENCE_CLASS_DEFN(_constant, T, _name) \
|
||||
class StoreReference##_name { \
|
||||
private: \
|
||||
static MOZ_MUST_USE bool store(JSContext* cx, T* heap, const Value& v, \
|
||||
TypedObject* obj, jsid id); \
|
||||
[[nodiscard]] static bool store(JSContext* cx, T* heap, const Value& v, \
|
||||
TypedObject* obj, jsid id); \
|
||||
\
|
||||
public: \
|
||||
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
static const JSJitInfo JitInfo; \
|
||||
};
|
||||
|
||||
@@ -883,7 +883,7 @@ class StoreReference##_name { \
|
||||
#define JS_LOAD_SCALAR_CLASS_DEFN(_constant, T, _name) \
|
||||
class LoadScalar##T { \
|
||||
public: \
|
||||
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
static const JSJitInfo JitInfo; \
|
||||
};
|
||||
|
||||
@@ -901,7 +901,7 @@ class LoadReference##_name { \
|
||||
static void load(T* heap, MutableHandleValue v); \
|
||||
\
|
||||
public: \
|
||||
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
|
||||
static const JSJitInfo JitInfo; \
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class WeakSetObject : public NativeObject
|
||||
static const JSFunctionSpec methods[];
|
||||
|
||||
static WeakSetObject* create(JSContext* cx, HandleObject proto = nullptr);
|
||||
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
static bool isBuiltinAdd(HandleValue add, JSContext* cx);
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ CreateCollatorPrototype(JSContext* cx, JS::Handle<JSObject*> Intl,
|
||||
*
|
||||
* Usage: collator = intl_Collator(locales, options)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_Collator(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ intl_Collator(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: collations = intl_availableCollations(locale)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_availableCollations(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ intl_availableCollations(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: result = intl_CompareStrings(collator, x, y)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: result = intl_isUpperCaseFirst(locale)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_isUpperCaseFirst(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ CreateDateTimeFormatPrototype(JSContext* cx, JS::Handle<JSObject*> Intl,
|
||||
*
|
||||
* Usage: dateTimeFormat = intl_DateTimeFormat(locales, options)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: calendars = intl_availableCalendars(locale)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: calendar = intl_defaultCalendar(locale)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_defaultCalendar(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ intl_defaultCalendar(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: ianaTimeZone = intl_IsValidTimeZoneName(timeZone)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_IsValidTimeZoneName(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ intl_IsValidTimeZoneName(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: ianaTimeZone = intl_canonicalizeTimeZone(timeZone)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_canonicalizeTimeZone(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ intl_canonicalizeTimeZone(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: icuDefaultTimeZone = intl_defaultTimeZone()
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_defaultTimeZone(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -110,7 +110,7 @@ intl_defaultTimeZone(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: defaultTimeZoneOffset = intl_defaultTimeZoneOffset()
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_defaultTimeZoneOffset(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ intl_defaultTimeZoneOffset(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: pattern = intl_patternForSkeleton(locale, skeleton, hourCycle)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp);
|
||||
* Usage: pattern = intl_patternForStyle(locale, dateStyle, timeStyle, timeZone,
|
||||
* hour12, hourCycle)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_patternForStyle(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ intl_patternForStyle(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: formatted = intl_FormatDateTime(dateTimeFormat, x, formatToParts)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ InitIntlClass(JSContext* cx, JS::Handle<JSObject*> obj);
|
||||
*
|
||||
* NOTE: "calendar" and "locale" properties are *not* added to the object.
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_GetCalendarInfo(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ intl_GetCalendarInfo(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
* 'AM'
|
||||
* ]
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_ComputeDisplayNames(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ intl_ComputeDisplayNames(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
*
|
||||
* Usage: result = intl_BestAvailableLocale("Collator", locale, defaultOrNull)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_BestAvailableLocale(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ intl_BestAvailableLocale(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
*
|
||||
* Usage: result = intl_supportedLocaleOrFallback(locale)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_supportedLocaleOrFallback(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
} // namespace js
|
||||
|
||||
@@ -220,9 +220,9 @@ class MOZ_STACK_CLASS LanguageTag final {
|
||||
|
||||
void performComplexLanguageMappings();
|
||||
void performComplexRegionMappings();
|
||||
MOZ_MUST_USE bool performVariantMappings(JSContext* cx);
|
||||
[[nodiscard]] bool performVariantMappings(JSContext* cx);
|
||||
|
||||
MOZ_MUST_USE bool updateGrandfatheredMappings(JSContext* cx);
|
||||
[[nodiscard]] bool updateGrandfatheredMappings(JSContext* cx);
|
||||
|
||||
static const char* replaceTransformExtensionType(
|
||||
mozilla::Span<const char> key, mozilla::Span<const char> type);
|
||||
@@ -716,21 +716,21 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LanguageTagParser::TokenKind)
|
||||
* Parse a string as a standalone |language| tag. If |str| is a standalone
|
||||
* language tag, store it in |result| and return true. Otherwise return false.
|
||||
*/
|
||||
MOZ_MUST_USE bool ParseStandaloneLanguageTag(JS::Handle<JSLinearString*> str,
|
||||
[[nodiscard]] bool ParseStandaloneLanguageTag(JS::Handle<JSLinearString*> str,
|
||||
LanguageSubtag& result);
|
||||
|
||||
/**
|
||||
* Parse a string as a standalone |script| tag. If |str| is a standalone script
|
||||
* tag, store it in |result| and return true. Otherwise return false.
|
||||
*/
|
||||
MOZ_MUST_USE bool ParseStandaloneScriptTag(JS::Handle<JSLinearString*> str,
|
||||
[[nodiscard]] bool ParseStandaloneScriptTag(JS::Handle<JSLinearString*> str,
|
||||
ScriptSubtag& result);
|
||||
|
||||
/**
|
||||
* Parse a string as a standalone |region| tag. If |str| is a standalone region
|
||||
* tag, store it in |result| and return true. Otherwise return false.
|
||||
*/
|
||||
MOZ_MUST_USE bool ParseStandaloneRegionTag(JS::Handle<JSLinearString*> str,
|
||||
[[nodiscard]] bool ParseStandaloneRegionTag(JS::Handle<JSLinearString*> str,
|
||||
RegionSubtag& result);
|
||||
|
||||
/**
|
||||
@@ -759,7 +759,7 @@ class UnicodeExtensionKeyword final {
|
||||
void trace(JSTracer* trc);
|
||||
};
|
||||
|
||||
extern MOZ_MUST_USE bool ApplyUnicodeExtensionToTag(
|
||||
[[nodiscard]] extern bool ApplyUnicodeExtensionToTag(
|
||||
JSContext* cx, LanguageTag& tag,
|
||||
JS::HandleVector<UnicodeExtensionKeyword> keywords);
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ extern JSObject* CreateLocalePrototype(JSContext* cx,
|
||||
JS::Handle<JSObject*> Intl,
|
||||
JS::Handle<GlobalObject*> global);
|
||||
|
||||
extern MOZ_MUST_USE bool intl_ValidateAndCanonicalizeLanguageTag(JSContext* cx,
|
||||
unsigned argc,
|
||||
Value* vp);
|
||||
[[nodiscard]] extern bool intl_ValidateAndCanonicalizeLanguageTag(JSContext* cx,
|
||||
unsigned argc,
|
||||
Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool intl_TryValidateAndCanonicalizeLanguageTag(
|
||||
[[nodiscard]] extern bool intl_TryValidateAndCanonicalizeLanguageTag(
|
||||
JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
extern MOZ_MUST_USE bool intl_ValidateAndCanonicalizeUnicodeExtensionType(
|
||||
[[nodiscard]] extern bool intl_ValidateAndCanonicalizeUnicodeExtensionType(
|
||||
JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
} // namespace js
|
||||
|
||||
@@ -47,7 +47,7 @@ CreateNumberFormatPrototype(JSContext* cx, HandleObject Intl, Handle<GlobalObjec
|
||||
*
|
||||
* Usage: numberFormat = intl_NumberFormat(locales, options)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_NumberFormat(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ intl_NumberFormat(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: defaultNumberingSystem = intl_numberingSystem(locale)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_numberingSystem(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -68,9 +68,9 @@ intl_numberingSystem(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: formatted = intl_FormatNumber(numberFormat, x, formatToParts)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp);
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
FormatNumeric(JSContext* cx, UNumberFormat* nf, HandleValue x, MutableHandleValue result);
|
||||
|
||||
} // namespace js
|
||||
|
||||
@@ -46,7 +46,7 @@ CreatePluralRulesPrototype(JSContext* cx, JS::Handle<JSObject*> Intl,
|
||||
*
|
||||
* Usage: pluralRules = intl_PluralRules(locales, options)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_PluralRules(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ intl_PluralRules(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* Usage: rule = intl_SelectPluralRule(pluralRules, x)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_SelectPluralRule(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ intl_SelectPluralRule(JSContext* cx, unsigned argc, Value* vp);
|
||||
*
|
||||
* intl_getPluralCategories('pl', 'cardinal'); // ['one', 'few', 'many', 'other']
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
[[nodiscard]] extern bool
|
||||
intl_GetPluralCategories(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
} // namespace js
|
||||
|
||||
@@ -48,8 +48,7 @@ CreateRelativeTimeFormatPrototype(JSContext* cx, JS::Handle<JSObject*> Intl,
|
||||
*
|
||||
* Usage: formatted = intl_FormatRelativeTime(relativeTimeFormat, t, unit)
|
||||
*/
|
||||
extern MOZ_MUST_USE bool
|
||||
intl_FormatRelativeTime(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] extern bool intl_FormatRelativeTime(JSContext* cx, unsigned argc, Value* vp);
|
||||
|
||||
} // namespace js
|
||||
|
||||
|
||||
@@ -233,9 +233,9 @@ class SharedIntlData
|
||||
* Sets |supported| to true if |locale| is supported by the requested Intl
|
||||
* service constructor. Otherwise sets |supported| to false.
|
||||
*/
|
||||
MOZ_MUST_USE bool isSupportedLocale(JSContext* cx, SupportedLocaleKind kind,
|
||||
JS::Handle<JSString*> locale,
|
||||
bool* supported);
|
||||
[[nodiscard]] bool isSupportedLocale(JSContext* cx, SupportedLocaleKind kind,
|
||||
JS::Handle<JSString*> locale,
|
||||
bool* supported);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -178,7 +178,7 @@ GetDeflatedUTF8StringLength(JSContext* maybecx, const CharT* chars,
|
||||
size_t charsLength);
|
||||
|
||||
template <typename CharT>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
DeflateStringToUTF8Buffer(JSContext* maybecx, const CharT* src, size_t srclen,
|
||||
char* dst, size_t* dstlenp);
|
||||
|
||||
@@ -456,7 +456,7 @@ namespace CType {
|
||||
TypeCode GetTypeCode(JSObject* typeObj);
|
||||
bool TypesEqual(JSObject* t1, JSObject* t2);
|
||||
size_t GetSize(JSObject* obj);
|
||||
MOZ_MUST_USE bool GetSafeSize(JSObject* obj, size_t* result);
|
||||
[[nodiscard]] bool GetSafeSize(JSObject* obj, size_t* result);
|
||||
bool IsSizeDefined(JSObject* obj);
|
||||
size_t GetAlignment(JSObject* obj);
|
||||
ffi_type* GetFFIType(JSContext* cx, JSObject* obj);
|
||||
@@ -480,12 +480,12 @@ namespace ArrayType {
|
||||
|
||||
JSObject* GetBaseType(JSObject* obj);
|
||||
size_t GetLength(JSObject* obj);
|
||||
MOZ_MUST_USE bool GetSafeLength(JSObject* obj, size_t* result);
|
||||
[[nodiscard]] bool GetSafeLength(JSObject* obj, size_t* result);
|
||||
UniquePtrFFIType BuildFFIType(JSContext* cx, JSObject* obj);
|
||||
} // namespace ArrayType
|
||||
|
||||
namespace StructType {
|
||||
MOZ_MUST_USE bool DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj);
|
||||
[[nodiscard]] bool DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj);
|
||||
|
||||
const FieldInfoHash* GetFieldInfo(JSObject* obj);
|
||||
const FieldInfo* LookupField(JSContext* cx, JSObject* obj, JSFlatString* name);
|
||||
@@ -521,9 +521,9 @@ namespace CData {
|
||||
bool IsCDataProto(JSObject* obj);
|
||||
|
||||
// Attached by JSAPI as the function 'ctypes.cast'
|
||||
MOZ_MUST_USE bool Cast(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool Cast(JSContext* cx, unsigned argc, Value* vp);
|
||||
// Attached by JSAPI as the function 'ctypes.getRuntime'
|
||||
MOZ_MUST_USE bool GetRuntime(JSContext* cx, unsigned argc, Value* vp);
|
||||
[[nodiscard]] bool GetRuntime(JSContext* cx, unsigned argc, Value* vp);
|
||||
} // namespace CData
|
||||
|
||||
namespace Int64 {
|
||||
|
||||
@@ -23,14 +23,14 @@ enum LibrarySlot {
|
||||
|
||||
namespace Library
|
||||
{
|
||||
MOZ_MUST_USE bool Name(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
[[nodiscard]] bool Name(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
JSObject* Create(JSContext* cx, JS::HandleValue path, const JSCTypesCallbacks* callbacks);
|
||||
|
||||
bool IsLibrary(JSObject* obj);
|
||||
PRLibrary* GetLibrary(JSObject* obj);
|
||||
|
||||
MOZ_MUST_USE bool Open(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
[[nodiscard]] bool Open(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
} // namespace Library
|
||||
|
||||
} // namespace ctypes
|
||||
|
||||
+3
-3
@@ -94,7 +94,7 @@ class Fifo
|
||||
// Push an element to the back of the queue. This method can take either a
|
||||
// |const T&| or a |T&&|.
|
||||
template <typename U>
|
||||
MOZ_MUST_USE bool pushBack(U&& u) {
|
||||
[[nodiscard]] bool pushBack(U&& u) {
|
||||
if (!rear_.append(mozilla::Forward<U>(u)))
|
||||
return false;
|
||||
if (!fixup()) {
|
||||
@@ -106,7 +106,7 @@ class Fifo
|
||||
|
||||
// Construct a T in-place at the back of the queue.
|
||||
template <typename... Args>
|
||||
MOZ_MUST_USE bool emplaceBack(Args&&... args) {
|
||||
[[nodiscard]] bool emplaceBack(Args&&... args) {
|
||||
if (!rear_.emplaceBack(mozilla::Forward<Args>(args)...))
|
||||
return false;
|
||||
if (!fixup()) {
|
||||
@@ -127,7 +127,7 @@ class Fifo
|
||||
}
|
||||
|
||||
// Remove the front element from the queue.
|
||||
MOZ_MUST_USE bool popFront() {
|
||||
[[nodiscard]] bool popFront() {
|
||||
MOZ_ASSERT(!empty());
|
||||
T t(mozilla::Move(front()));
|
||||
front_.popBack();
|
||||
|
||||
@@ -67,7 +67,7 @@ class InlineTable
|
||||
return inlNext_ > InlineEntries;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool switchToTable() {
|
||||
[[nodiscard]] bool switchToTable() {
|
||||
MOZ_ASSERT(inlNext_ == InlineEntries);
|
||||
|
||||
if (table_.initialized()) {
|
||||
@@ -91,7 +91,7 @@ class InlineTable
|
||||
}
|
||||
|
||||
MOZ_NEVER_INLINE
|
||||
MOZ_MUST_USE bool switchAndAdd(const InlineEntry& entry) {
|
||||
[[nodiscard]] bool switchAndAdd(const InlineEntry& entry) {
|
||||
if (!switchToTable())
|
||||
return false;
|
||||
|
||||
@@ -285,7 +285,7 @@ class InlineTable
|
||||
template <typename KeyInput,
|
||||
typename... Args>
|
||||
MOZ_ALWAYS_INLINE
|
||||
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& key, Args&&... args) {
|
||||
[[nodiscard]] bool add(AddPtr& p, KeyInput&& key, Args&&... args) {
|
||||
MOZ_ASSERT(!p);
|
||||
MOZ_ASSERT(keyNonZero(key));
|
||||
|
||||
@@ -439,7 +439,7 @@ class InlineMap
|
||||
this->value = mozilla::Forward<ValueInput>(value);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool moveTo(Map& map) {
|
||||
[[nodiscard]] bool moveTo(Map& map) {
|
||||
return map.putNew(mozilla::Move(key), mozilla::Move(value));
|
||||
}
|
||||
};
|
||||
@@ -531,12 +531,12 @@ class InlineMap
|
||||
|
||||
template <typename KeyInput, typename ValueInput>
|
||||
MOZ_ALWAYS_INLINE
|
||||
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& key, ValueInput&& value) {
|
||||
[[nodiscard]] bool add(AddPtr& p, KeyInput&& key, ValueInput&& value) {
|
||||
return impl_.add(p, mozilla::Forward<KeyInput>(key), mozilla::Forward<ValueInput>(value));
|
||||
}
|
||||
|
||||
template <typename KeyInput, typename ValueInput>
|
||||
MOZ_MUST_USE bool put(KeyInput&& key, ValueInput&& value) {
|
||||
[[nodiscard]] bool put(KeyInput&& key, ValueInput&& value) {
|
||||
AddPtr p = lookupForAdd(key);
|
||||
if (p) {
|
||||
p->value() = mozilla::Forward<ValueInput>(value);
|
||||
@@ -577,7 +577,7 @@ class InlineSet
|
||||
this->key = mozilla::Forward<TInput>(key);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool moveTo(Set& set) {
|
||||
[[nodiscard]] bool moveTo(Set& set) {
|
||||
return set.putNew(mozilla::Move(key));
|
||||
}
|
||||
};
|
||||
@@ -662,12 +662,12 @@ class InlineSet
|
||||
|
||||
template <typename TInput>
|
||||
MOZ_ALWAYS_INLINE
|
||||
MOZ_MUST_USE bool add(AddPtr& p, TInput&& key) {
|
||||
[[nodiscard]] bool add(AddPtr& p, TInput&& key) {
|
||||
return impl_.add(p, mozilla::Forward<TInput>(key));
|
||||
}
|
||||
|
||||
template <typename TInput>
|
||||
MOZ_MUST_USE bool put(TInput&& key) {
|
||||
[[nodiscard]] bool put(TInput&& key) {
|
||||
AddPtr p = lookupForAdd(key);
|
||||
return p ? true : add(p, mozilla::Forward<TInput>(key));
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ class LifoAlloc
|
||||
// allocation requests, not necessarily contiguous. Note that this does
|
||||
// not guarantee a successful single allocation of N bytes.
|
||||
MOZ_ALWAYS_INLINE
|
||||
MOZ_MUST_USE bool ensureUnusedApproximate(size_t n) {
|
||||
[[nodiscard]] bool ensureUnusedApproximate(size_t n) {
|
||||
AutoFallibleScope fallibleAllocator(this);
|
||||
size_t total = 0;
|
||||
for (BumpChunk* chunk = latest; chunk; chunk = chunk->next()) {
|
||||
@@ -640,7 +640,7 @@ class LifoAllocPolicy
|
||||
}
|
||||
void reportAllocOverflow() const {
|
||||
}
|
||||
MOZ_MUST_USE bool checkSimulatedOOM() const {
|
||||
[[nodiscard]] bool checkSimulatedOOM() const {
|
||||
return fb == Infallible || !js::oom::ShouldFailWithOOM();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ class OrderedHashTable
|
||||
OrderedHashTable(AllocPolicy& ap, mozilla::HashCodeScrambler hcs)
|
||||
: hashTable(nullptr), data(nullptr), dataLength(0), ranges(nullptr), alloc(ap), hcs(hcs) {}
|
||||
|
||||
MOZ_MUST_USE bool init() {
|
||||
[[nodiscard]] bool init() {
|
||||
MOZ_ASSERT(!hashTable, "init must be called at most once");
|
||||
|
||||
uint32_t buckets = initialBuckets();
|
||||
@@ -153,7 +153,7 @@ class OrderedHashTable
|
||||
* means the element was not added to the table.
|
||||
*/
|
||||
template <typename ElementInput>
|
||||
MOZ_MUST_USE bool put(ElementInput&& element) {
|
||||
[[nodiscard]] bool put(ElementInput&& element) {
|
||||
HashNumber h = prepareHash(Ops::getKey(element));
|
||||
if (Data* e = lookup(Ops::getKey(element), h)) {
|
||||
e->element = Forward<ElementInput>(element);
|
||||
@@ -224,7 +224,7 @@ class OrderedHashTable
|
||||
* particular, those Ranges are still live and will see any entries added
|
||||
* after a successful clear().
|
||||
*/
|
||||
MOZ_MUST_USE bool clear() {
|
||||
[[nodiscard]] bool clear() {
|
||||
if (dataLength != 0) {
|
||||
Data** oldHashTable = hashTable;
|
||||
Data* oldData = data;
|
||||
@@ -633,7 +633,7 @@ class OrderedHashTable
|
||||
* empty elements in data[0:dataLength]. On allocation failure, this
|
||||
* leaves everything as it was and returns false.
|
||||
*/
|
||||
MOZ_MUST_USE bool rehash(uint32_t newHashShift) {
|
||||
[[nodiscard]] bool rehash(uint32_t newHashShift) {
|
||||
// If the size of the table is not changing, rehash in place to avoid
|
||||
// allocating memory.
|
||||
if (newHashShift == hashShift) {
|
||||
@@ -746,17 +746,17 @@ class OrderedHashMap
|
||||
typedef typename Impl::Range Range;
|
||||
|
||||
OrderedHashMap(AllocPolicy ap, mozilla::HashCodeScrambler hcs) : impl(ap, hcs) {}
|
||||
MOZ_MUST_USE bool init() { return impl.init(); }
|
||||
[[nodiscard]] bool init() { return impl.init(); }
|
||||
uint32_t count() const { return impl.count(); }
|
||||
bool has(const Key& key) const { return impl.has(key); }
|
||||
Range all() { return impl.all(); }
|
||||
const Entry* get(const Key& key) const { return impl.get(key); }
|
||||
Entry* get(const Key& key) { return impl.get(key); }
|
||||
bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); }
|
||||
MOZ_MUST_USE bool clear() { return impl.clear(); }
|
||||
[[nodiscard]] bool clear() { return impl.clear(); }
|
||||
|
||||
template <typename V>
|
||||
MOZ_MUST_USE bool put(const Key& key, V&& value) {
|
||||
[[nodiscard]] bool put(const Key& key, V&& value) {
|
||||
return impl.put(Entry(key, Forward<V>(value)));
|
||||
}
|
||||
|
||||
@@ -804,13 +804,13 @@ class OrderedHashSet
|
||||
typedef typename Impl::Range Range;
|
||||
|
||||
explicit OrderedHashSet(AllocPolicy ap, mozilla::HashCodeScrambler hcs) : impl(ap, hcs) {}
|
||||
MOZ_MUST_USE bool init() { return impl.init(); }
|
||||
[[nodiscard]] bool init() { return impl.init(); }
|
||||
uint32_t count() const { return impl.count(); }
|
||||
bool has(const T& value) const { return impl.has(value); }
|
||||
Range all() { return impl.all(); }
|
||||
MOZ_MUST_USE bool put(const T& value) { return impl.put(value); }
|
||||
[[nodiscard]] bool put(const T& value) { return impl.put(value); }
|
||||
bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); }
|
||||
MOZ_MUST_USE bool clear() { return impl.clear(); }
|
||||
[[nodiscard]] bool clear() { return impl.clear(); }
|
||||
|
||||
HashNumber hash(const T& value) const { return impl.prepareHash(value); }
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ class PageProtectingVector final
|
||||
unprotectedBytes = 0;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool reserve(size_t size) {
|
||||
[[nodiscard]] bool reserve(size_t size) {
|
||||
AutoUnprotect guard;
|
||||
if (size > vector.capacity())
|
||||
guard.emplace(this);
|
||||
@@ -237,7 +237,7 @@ class PageProtectingVector final
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
MOZ_MUST_USE bool append(const U* values, size_t size) {
|
||||
[[nodiscard]] bool append(const U* values, size_t size) {
|
||||
bool ret;
|
||||
{
|
||||
AutoUnprotect guard;
|
||||
|
||||
@@ -34,7 +34,7 @@ class PriorityQueue
|
||||
: heap(ap)
|
||||
{}
|
||||
|
||||
MOZ_MUST_USE bool reserve(size_t capacity) {
|
||||
[[nodiscard]] bool reserve(size_t capacity) {
|
||||
return heap.reserve(capacity);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class PriorityQueue
|
||||
return highest;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool insert(const T& v) {
|
||||
[[nodiscard]] bool insert(const T& v) {
|
||||
if (!heap.append(v))
|
||||
return false;
|
||||
siftUp(heap.length() - 1);
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ MergeArrayRuns(T* dst, const T* src, size_t run1, size_t run2, Comparator c)
|
||||
* arbitrary.
|
||||
*/
|
||||
template<typename T, typename Comparator>
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
MergeSort(T* array, size_t nelems, T* scratch, Comparator c)
|
||||
{
|
||||
const size_t INS_SORT_LIMIT = 3;
|
||||
|
||||
@@ -89,7 +89,7 @@ class SplayTree
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool insert(const T& v)
|
||||
[[nodiscard]] bool insert(const T& v)
|
||||
{
|
||||
Node* element = allocateNode(v);
|
||||
if (!element)
|
||||
|
||||
@@ -49,7 +49,7 @@ CompileModule(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
|
||||
SourceBufferHolder& srcBuf, LifoAlloc& alloc,
|
||||
ScriptSourceObject** sourceObjectOut = nullptr);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* chars, size_t length);
|
||||
|
||||
//
|
||||
@@ -64,32 +64,32 @@ CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* cha
|
||||
// Function("/*", "*/x) {")
|
||||
// Function("x){ if (3", "return x;}")
|
||||
//
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
CompileStandaloneFunction(JSContext* cx, MutableHandleFunction fun,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
JS::SourceBufferHolder& srcBuf,
|
||||
mozilla::Maybe<uint32_t> parameterListEnd,
|
||||
HandleScope enclosingScope = nullptr);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
CompileStandaloneGenerator(JSContext* cx, MutableHandleFunction fun,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
JS::SourceBufferHolder& srcBuf,
|
||||
mozilla::Maybe<uint32_t> parameterListEnd);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
CompileStandaloneAsyncFunction(JSContext* cx, MutableHandleFunction fun,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
JS::SourceBufferHolder& srcBuf,
|
||||
mozilla::Maybe<uint32_t> parameterListEnd);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
CompileStandaloneAsyncGenerator(JSContext* cx, MutableHandleFunction fun,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
JS::SourceBufferHolder& srcBuf,
|
||||
mozilla::Maybe<uint32_t> parameterListEnd);
|
||||
|
||||
MOZ_MUST_USE bool
|
||||
[[nodiscard]] bool
|
||||
CompileAsyncFunctionBody(JSContext* cx, MutableHandleFunction fun,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf);
|
||||
|
||||
@@ -64,7 +64,7 @@ class BreakableControl : public NestableControl
|
||||
|
||||
BreakableControl(BytecodeEmitter* bce, StatementKind kind);
|
||||
|
||||
MOZ_MUST_USE bool patchBreaks(BytecodeEmitter* bce);
|
||||
[[nodiscard]] bool patchBreaks(BytecodeEmitter* bce);
|
||||
};
|
||||
template <>
|
||||
inline bool
|
||||
@@ -131,7 +131,7 @@ class LoopControl : public BreakableControl
|
||||
return canIonOsr_;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool patchBreaksAndContinues(BytecodeEmitter* bce);
|
||||
[[nodiscard]] bool patchBreaksAndContinues(BytecodeEmitter* bce);
|
||||
};
|
||||
template <>
|
||||
inline bool
|
||||
|
||||
@@ -144,13 +144,13 @@ class MOZ_RAII OptionalEmitter
|
||||
Other
|
||||
};
|
||||
|
||||
MOZ_MUST_USE bool emitJumpShortCircuit();
|
||||
MOZ_MUST_USE bool emitJumpShortCircuitForCall();
|
||||
[[nodiscard]] bool emitJumpShortCircuit();
|
||||
[[nodiscard]] bool emitJumpShortCircuitForCall();
|
||||
|
||||
// JSOp is the op code to be emitted, Kind is if we are dealing with a
|
||||
// reference (in which case we need two elements on the stack) or other value
|
||||
// (which needs one element on the stack)
|
||||
MOZ_MUST_USE bool emitOptionalJumpTarget(JSOp op, Kind kind = Kind::Other);
|
||||
[[nodiscard]] bool emitOptionalJumpTarget(JSOp op, Kind kind = Kind::Other);
|
||||
};
|
||||
|
||||
BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent,
|
||||
@@ -708,7 +708,7 @@ class NonLocalExitControl
|
||||
|
||||
NonLocalExitControl(const NonLocalExitControl&) = delete;
|
||||
|
||||
MOZ_MUST_USE bool leaveScope(EmitterScope* scope);
|
||||
[[nodiscard]] bool leaveScope(EmitterScope* scope);
|
||||
|
||||
public:
|
||||
NonLocalExitControl(BytecodeEmitter* bce, Kind kind)
|
||||
@@ -725,9 +725,9 @@ class NonLocalExitControl
|
||||
bce_->stackDepth = savedDepth_;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool prepareForNonLocalJump(NestableControl* target);
|
||||
[[nodiscard]] bool prepareForNonLocalJump(NestableControl* target);
|
||||
|
||||
MOZ_MUST_USE bool prepareForNonLocalJumpToOutermost() {
|
||||
[[nodiscard]] bool prepareForNonLocalJumpToOutermost() {
|
||||
return prepareForNonLocalJump(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
+197
-197
@@ -40,7 +40,7 @@ class CGConstList {
|
||||
explicit CGConstList(ExclusiveContext* cx)
|
||||
: vector(cx, ValueVector(cx))
|
||||
{ }
|
||||
MOZ_MUST_USE bool append(const Value& v) {
|
||||
[[nodiscard]] bool append(const Value& v) {
|
||||
return vector.append(v);
|
||||
}
|
||||
size_t length() const { return vector.length(); }
|
||||
@@ -75,7 +75,7 @@ struct CGTryNoteList {
|
||||
Vector<JSTryNote> list;
|
||||
explicit CGTryNoteList(ExclusiveContext* cx) : list(cx) {}
|
||||
|
||||
MOZ_MUST_USE bool append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, size_t end);
|
||||
[[nodiscard]] bool append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, size_t end);
|
||||
size_t length() const { return list.length(); }
|
||||
void finish(TryNoteArray* array);
|
||||
};
|
||||
@@ -97,7 +97,7 @@ struct CGScopeNoteList {
|
||||
Vector<CGScopeNote> list;
|
||||
explicit CGScopeNoteList(ExclusiveContext* cx) : list(cx) {}
|
||||
|
||||
MOZ_MUST_USE bool append(uint32_t scopeIndex, uint32_t offset, bool inPrologue,
|
||||
[[nodiscard]] bool append(uint32_t scopeIndex, uint32_t offset, bool inPrologue,
|
||||
uint32_t parent);
|
||||
void recordEnd(uint32_t index, uint32_t offset, bool inPrologue);
|
||||
size_t length() const { return list.length(); }
|
||||
@@ -110,7 +110,7 @@ struct CGYieldAndAwaitOffsetList {
|
||||
uint32_t numAwaits;
|
||||
explicit CGYieldAndAwaitOffsetList(ExclusiveContext* cx) : list(cx), numYields(0), numAwaits(0) {}
|
||||
|
||||
MOZ_MUST_USE bool append(uint32_t offset) { return list.append(offset); }
|
||||
[[nodiscard]] bool append(uint32_t offset) { return list.append(offset); }
|
||||
size_t length() const { return list.length(); }
|
||||
void finish(YieldAndAwaitOffsetArray& array, uint32_t prologueLength);
|
||||
};
|
||||
@@ -264,7 +264,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
TokenPos bodyPosition, EmitterMode emitterMode = Normal,
|
||||
FieldInitializers fieldInitializers = FieldInitializers::Invalid());
|
||||
|
||||
MOZ_MUST_USE bool init();
|
||||
[[nodiscard]] bool init();
|
||||
|
||||
template <typename T>
|
||||
T* findInnermostNestableControl() const;
|
||||
@@ -300,7 +300,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
Scope* innermostScope() const;
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
MOZ_MUST_USE bool makeAtomIndex(JSAtom* atom, uint32_t* indexp) {
|
||||
[[nodiscard]] bool makeAtomIndex(JSAtom* atom, uint32_t* indexp) {
|
||||
MOZ_ASSERT(atomIndices);
|
||||
AtomIndexMap::AddPtr p = atomIndices->lookupForAdd(atom);
|
||||
if (p) {
|
||||
@@ -317,16 +317,16 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
}
|
||||
|
||||
bool isInLoop();
|
||||
MOZ_MUST_USE bool checkSingletonContext();
|
||||
[[nodiscard]] bool checkSingletonContext();
|
||||
|
||||
// Check whether our function is in a run-once context (a toplevel
|
||||
// run-one script or a run-once lambda).
|
||||
MOZ_MUST_USE bool checkRunOnceContext();
|
||||
[[nodiscard]] bool checkRunOnceContext();
|
||||
|
||||
bool needsImplicitThis();
|
||||
|
||||
MOZ_MUST_USE bool maybeSetDisplayURL();
|
||||
MOZ_MUST_USE bool maybeSetSourceMap();
|
||||
[[nodiscard]] bool maybeSetDisplayURL();
|
||||
[[nodiscard]] bool maybeSetSourceMap();
|
||||
void tellDebuggerAboutCompiledScript(ExclusiveContext* cx);
|
||||
|
||||
inline TokenStream& tokenStream();
|
||||
@@ -383,29 +383,29 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
// statement, we define useless code as code with no side effects, because
|
||||
// the main effect, the value left on the stack after the code executes,
|
||||
// will be discarded by a pop bytecode.
|
||||
MOZ_MUST_USE bool checkSideEffects(ParseNode* pn, bool* answer);
|
||||
[[nodiscard]] bool checkSideEffects(ParseNode* pn, bool* answer);
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_MUST_USE bool checkStrictOrSloppy(JSOp op);
|
||||
[[nodiscard]] bool checkStrictOrSloppy(JSOp op);
|
||||
#endif
|
||||
|
||||
// Append a new source note of the given type (and therefore size) to the
|
||||
// notes dynamic array, updating noteCount. Return the new note's index
|
||||
// within the array pointed at by current->notes as outparam.
|
||||
MOZ_MUST_USE bool newSrcNote(SrcNoteType type, unsigned* indexp = nullptr);
|
||||
MOZ_MUST_USE bool newSrcNote2(SrcNoteType type, ptrdiff_t offset, unsigned* indexp = nullptr);
|
||||
MOZ_MUST_USE bool newSrcNote3(SrcNoteType type, ptrdiff_t offset1, ptrdiff_t offset2,
|
||||
[[nodiscard]] bool newSrcNote(SrcNoteType type, unsigned* indexp = nullptr);
|
||||
[[nodiscard]] bool newSrcNote2(SrcNoteType type, ptrdiff_t offset, unsigned* indexp = nullptr);
|
||||
[[nodiscard]] bool newSrcNote3(SrcNoteType type, ptrdiff_t offset1, ptrdiff_t offset2,
|
||||
unsigned* indexp = nullptr);
|
||||
|
||||
void copySrcNotes(jssrcnote* destination, uint32_t nsrcnotes);
|
||||
MOZ_MUST_USE bool setSrcNoteOffset(unsigned index, unsigned which, ptrdiff_t offset);
|
||||
[[nodiscard]] bool setSrcNoteOffset(unsigned index, unsigned which, ptrdiff_t offset);
|
||||
|
||||
// NB: this function can add at most one extra extended delta note.
|
||||
MOZ_MUST_USE bool addToSrcNoteDelta(jssrcnote* sn, ptrdiff_t delta);
|
||||
[[nodiscard]] bool addToSrcNoteDelta(jssrcnote* sn, ptrdiff_t delta);
|
||||
|
||||
// Finish taking source notes in cx's notePool. If successful, the final
|
||||
// source note count is stored in the out outparam.
|
||||
MOZ_MUST_USE bool finishTakingSrcNotes(uint32_t* out);
|
||||
[[nodiscard]] bool finishTakingSrcNotes(uint32_t* out);
|
||||
|
||||
// Control whether emitTree emits a line number note.
|
||||
enum EmitLineNumberNote {
|
||||
@@ -414,242 +414,242 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
};
|
||||
|
||||
// Emit code for the tree rooted at pn.
|
||||
MOZ_MUST_USE bool emitTree(ParseNode* pn, ValueUsage valueUsage = ValueUsage::WantValue,
|
||||
[[nodiscard]] bool emitTree(ParseNode* pn, ValueUsage valueUsage = ValueUsage::WantValue,
|
||||
EmitLineNumberNote emitLineNote = EMIT_LINENOTE);
|
||||
|
||||
// Emit code for the optional tree rooted at pn.
|
||||
MOZ_MUST_USE bool emitOptionalTree(ParseNode* pn,
|
||||
[[nodiscard]] bool emitOptionalTree(ParseNode* pn,
|
||||
OptionalEmitter& oe,
|
||||
ValueUsage valueUsage = ValueUsage::WantValue);
|
||||
|
||||
// Emit code for the tree rooted at pn with its own TDZ cache.
|
||||
MOZ_MUST_USE bool emitTreeInBranch(ParseNode* pn,
|
||||
[[nodiscard]] bool emitTreeInBranch(ParseNode* pn,
|
||||
ValueUsage valueUsage = ValueUsage::WantValue);
|
||||
|
||||
// Emit global, eval, or module code for tree rooted at body. Always
|
||||
// encompasses the entire source.
|
||||
MOZ_MUST_USE bool emitScript(ParseNode* body);
|
||||
[[nodiscard]] bool emitScript(ParseNode* body);
|
||||
|
||||
// Emit function code for the tree rooted at body.
|
||||
MOZ_MUST_USE bool emitFunctionScript(FunctionNode* funNode);
|
||||
[[nodiscard]] bool emitFunctionScript(FunctionNode* funNode);
|
||||
|
||||
void updateDepth(ptrdiff_t target);
|
||||
MOZ_MUST_USE bool updateLineNumberNotes(uint32_t offset);
|
||||
MOZ_MUST_USE bool updateSourceCoordNotes(uint32_t offset);
|
||||
[[nodiscard]] bool updateLineNumberNotes(uint32_t offset);
|
||||
[[nodiscard]] bool updateSourceCoordNotes(uint32_t offset);
|
||||
|
||||
JSOp strictifySetNameOp(JSOp op);
|
||||
|
||||
MOZ_MUST_USE bool emitCheck(JSOp op, ptrdiff_t delta, ptrdiff_t* offset);
|
||||
[[nodiscard]] bool emitCheck(JSOp op, ptrdiff_t delta, ptrdiff_t* offset);
|
||||
|
||||
// Emit one bytecode.
|
||||
MOZ_MUST_USE bool emit1(JSOp op);
|
||||
[[nodiscard]] bool emit1(JSOp op);
|
||||
|
||||
// Emit two bytecodes, an opcode (op) with a byte of immediate operand
|
||||
// (op1).
|
||||
MOZ_MUST_USE bool emit2(JSOp op, uint8_t op1);
|
||||
[[nodiscard]] bool emit2(JSOp op, uint8_t op1);
|
||||
|
||||
// Emit three bytecodes, an opcode with two bytes of immediate operands.
|
||||
MOZ_MUST_USE bool emit3(JSOp op, jsbytecode op1, jsbytecode op2);
|
||||
[[nodiscard]] bool emit3(JSOp op, jsbytecode op1, jsbytecode op2);
|
||||
|
||||
// Helper to emit JSOP_DUPAT. The argument is the value's depth on the
|
||||
// JS stack, as measured from the top.
|
||||
MOZ_MUST_USE bool emitDupAt(unsigned slotFromTop);
|
||||
[[nodiscard]] bool emitDupAt(unsigned slotFromTop);
|
||||
|
||||
// Helper to emit JSOP_POP or JSOP_POPN.
|
||||
MOZ_MUST_USE bool emitPopN(unsigned n);
|
||||
[[nodiscard]] bool emitPopN(unsigned n);
|
||||
|
||||
// Helper to emit JSOP_SWAP or JSOP_UNPICK.
|
||||
MOZ_MUST_USE bool emitUnpickN(unsigned n);
|
||||
[[nodiscard]] bool emitUnpickN(unsigned n);
|
||||
|
||||
// Helper to emit JSOP_CHECKISOBJ.
|
||||
MOZ_MUST_USE bool emitCheckIsObj(CheckIsObjectKind kind);
|
||||
[[nodiscard]] bool emitCheckIsObj(CheckIsObjectKind kind);
|
||||
|
||||
// Helper to emit JSOP_CHECKISCALLABLE.
|
||||
MOZ_MUST_USE bool emitCheckIsCallable(CheckIsCallableKind kind);
|
||||
[[nodiscard]] bool emitCheckIsCallable(CheckIsCallableKind kind);
|
||||
|
||||
// Emit a bytecode followed by an uint16 immediate operand stored in
|
||||
// big-endian order.
|
||||
MOZ_MUST_USE bool emitUint16Operand(JSOp op, uint32_t operand);
|
||||
[[nodiscard]] bool emitUint16Operand(JSOp op, uint32_t operand);
|
||||
|
||||
// Emit a bytecode followed by an uint32 immediate operand.
|
||||
MOZ_MUST_USE bool emitUint32Operand(JSOp op, uint32_t operand);
|
||||
[[nodiscard]] bool emitUint32Operand(JSOp op, uint32_t operand);
|
||||
|
||||
// Emit (1 + extra) bytecodes, for N bytes of op and its immediate operand.
|
||||
MOZ_MUST_USE bool emitN(JSOp op, size_t extra, ptrdiff_t* offset = nullptr);
|
||||
[[nodiscard]] bool emitN(JSOp op, size_t extra, ptrdiff_t* offset = nullptr);
|
||||
|
||||
MOZ_MUST_USE bool emitNumberOp(double dval);
|
||||
[[nodiscard]] bool emitNumberOp(double dval);
|
||||
|
||||
MOZ_MUST_USE bool emitBigIntOp(BigInt* bigint);
|
||||
[[nodiscard]] bool emitBigIntOp(BigInt* bigint);
|
||||
|
||||
MOZ_MUST_USE bool emitThisLiteral(ThisLiteral* pn);
|
||||
MOZ_MUST_USE bool emitGetFunctionThis(ParseNode* pn);
|
||||
MOZ_MUST_USE bool emitGetFunctionThis(const mozilla::Maybe<uint32_t>& offset);
|
||||
MOZ_MUST_USE bool emitGetThisForSuperBase(UnaryNode* superBase);
|
||||
MOZ_MUST_USE bool emitSetThis(BinaryNode* setThisNode);
|
||||
MOZ_MUST_USE bool emitCheckDerivedClassConstructorReturn();
|
||||
[[nodiscard]] bool emitThisLiteral(ThisLiteral* pn);
|
||||
[[nodiscard]] bool emitGetFunctionThis(ParseNode* pn);
|
||||
[[nodiscard]] bool emitGetFunctionThis(const mozilla::Maybe<uint32_t>& offset);
|
||||
[[nodiscard]] bool emitGetThisForSuperBase(UnaryNode* superBase);
|
||||
[[nodiscard]] bool emitSetThis(BinaryNode* setThisNode);
|
||||
[[nodiscard]] bool emitCheckDerivedClassConstructorReturn();
|
||||
|
||||
// Handle jump opcodes and jump targets.
|
||||
MOZ_MUST_USE bool emitJumpTarget(JumpTarget* target);
|
||||
MOZ_MUST_USE bool emitJumpNoFallthrough(JSOp op, JumpList* jump);
|
||||
MOZ_MUST_USE bool emitJump(JSOp op, JumpList* jump);
|
||||
MOZ_MUST_USE bool emitBackwardJump(JSOp op, JumpTarget target, JumpList* jump,
|
||||
[[nodiscard]] bool emitJumpTarget(JumpTarget* target);
|
||||
[[nodiscard]] bool emitJumpNoFallthrough(JSOp op, JumpList* jump);
|
||||
[[nodiscard]] bool emitJump(JSOp op, JumpList* jump);
|
||||
[[nodiscard]] bool emitBackwardJump(JSOp op, JumpTarget target, JumpList* jump,
|
||||
JumpTarget* fallthrough);
|
||||
void patchJumpsToTarget(JumpList jump, JumpTarget target);
|
||||
MOZ_MUST_USE bool emitJumpTargetAndPatch(JumpList jump);
|
||||
[[nodiscard]] bool emitJumpTargetAndPatch(JumpList jump);
|
||||
|
||||
MOZ_MUST_USE bool emitCall(JSOp op, uint16_t argc,
|
||||
[[nodiscard]] bool emitCall(JSOp op, uint16_t argc,
|
||||
const mozilla::Maybe<uint32_t>& sourceCoordOffset);
|
||||
MOZ_MUST_USE bool emitCall(JSOp op, uint16_t argc, ParseNode* pn = nullptr);
|
||||
MOZ_MUST_USE bool emitCallIncDec(UnaryNode* incDec);
|
||||
[[nodiscard]] bool emitCall(JSOp op, uint16_t argc, ParseNode* pn = nullptr);
|
||||
[[nodiscard]] bool emitCallIncDec(UnaryNode* incDec);
|
||||
|
||||
MOZ_MUST_USE bool emitLoopHead(ParseNode* nextpn, JumpTarget* top);
|
||||
MOZ_MUST_USE bool emitLoopEntry(ParseNode* nextpn, JumpList entryJump);
|
||||
[[nodiscard]] bool emitLoopHead(ParseNode* nextpn, JumpTarget* top);
|
||||
[[nodiscard]] bool emitLoopEntry(ParseNode* nextpn, JumpList entryJump);
|
||||
|
||||
MOZ_MUST_USE bool emitGoto(NestableControl* target, JumpList* jumplist,
|
||||
[[nodiscard]] bool emitGoto(NestableControl* target, JumpList* jumplist,
|
||||
SrcNoteType noteType = SRC_NULL);
|
||||
|
||||
MOZ_MUST_USE bool emitIndex32(JSOp op, uint32_t index);
|
||||
MOZ_MUST_USE bool emitIndexOp(JSOp op, uint32_t index);
|
||||
[[nodiscard]] bool emitIndex32(JSOp op, uint32_t index);
|
||||
[[nodiscard]] bool emitIndexOp(JSOp op, uint32_t index);
|
||||
|
||||
MOZ_MUST_USE bool emitAtomOp(JSAtom* atom, JSOp op);
|
||||
MOZ_MUST_USE bool emitAtomOp(uint32_t atomIndex, JSOp op);
|
||||
[[nodiscard]] bool emitAtomOp(JSAtom* atom, JSOp op);
|
||||
[[nodiscard]] bool emitAtomOp(uint32_t atomIndex, JSOp op);
|
||||
|
||||
MOZ_MUST_USE bool emitArrayLiteral(ListNode* array);
|
||||
MOZ_MUST_USE bool emitArray(ParseNode* arrayHead, uint32_t count, JSOp op);
|
||||
MOZ_MUST_USE bool emitArrayComp(ListNode* pn);
|
||||
[[nodiscard]] bool emitArrayLiteral(ListNode* array);
|
||||
[[nodiscard]] bool emitArray(ParseNode* arrayHead, uint32_t count, JSOp op);
|
||||
[[nodiscard]] bool emitArrayComp(ListNode* pn);
|
||||
|
||||
MOZ_MUST_USE bool emitInternedScopeOp(uint32_t index, JSOp op);
|
||||
MOZ_MUST_USE bool emitInternedObjectOp(uint32_t index, JSOp op);
|
||||
MOZ_MUST_USE bool emitObjectOp(ObjectBox* objbox, JSOp op);
|
||||
MOZ_MUST_USE bool emitObjectPairOp(ObjectBox* objbox1, ObjectBox* objbox2, JSOp op);
|
||||
MOZ_MUST_USE bool emitRegExp(uint32_t index);
|
||||
[[nodiscard]] bool emitInternedScopeOp(uint32_t index, JSOp op);
|
||||
[[nodiscard]] bool emitInternedObjectOp(uint32_t index, JSOp op);
|
||||
[[nodiscard]] bool emitObjectOp(ObjectBox* objbox, JSOp op);
|
||||
[[nodiscard]] bool emitObjectPairOp(ObjectBox* objbox1, ObjectBox* objbox2, JSOp op);
|
||||
[[nodiscard]] bool emitRegExp(uint32_t index);
|
||||
|
||||
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitFunction(FunctionNode* funNode,
|
||||
[[nodiscard]] MOZ_NEVER_INLINE bool emitFunction(FunctionNode* funNode,
|
||||
bool needsProto = false,
|
||||
ListNode* classContentsIfConstructor = nullptr);
|
||||
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitObject(ListNode* objNode);
|
||||
[[nodiscard]] MOZ_NEVER_INLINE bool emitObject(ListNode* objNode);
|
||||
|
||||
MOZ_MUST_USE bool replaceNewInitWithNewObject(JSObject* obj, ptrdiff_t offset);
|
||||
[[nodiscard]] bool replaceNewInitWithNewObject(JSObject* obj, ptrdiff_t offset);
|
||||
|
||||
MOZ_MUST_USE bool emitHoistedFunctionsInList(ListNode* stmtList);
|
||||
[[nodiscard]] bool emitHoistedFunctionsInList(ListNode* stmtList);
|
||||
|
||||
MOZ_MUST_USE bool emitPropertyList(ListNode* obj, PropertyEmitter& pe,
|
||||
[[nodiscard]] bool emitPropertyList(ListNode* obj, PropertyEmitter& pe,
|
||||
PropListType type);
|
||||
|
||||
enum class FieldPlacement { Instance, Static };
|
||||
FieldInitializers setupFieldInitializers(ListNode* classMembers, FieldPlacement placement);
|
||||
MOZ_MUST_USE bool emitCreateFieldKeys(ListNode* obj, FieldPlacement placement);
|
||||
MOZ_MUST_USE bool emitCreateFieldInitializers(ClassEmitter& ce, ListNode* obj, FieldPlacement placement);
|
||||
[[nodiscard]] bool emitCreateFieldKeys(ListNode* obj, FieldPlacement placement);
|
||||
[[nodiscard]] bool emitCreateFieldInitializers(ClassEmitter& ce, ListNode* obj, FieldPlacement placement);
|
||||
const FieldInitializers& findFieldInitializersForCall();
|
||||
MOZ_MUST_USE bool emitInitializeInstanceFields();
|
||||
MOZ_MUST_USE bool emitInitializeStaticFields(ListNode* classMembers);
|
||||
[[nodiscard]] bool emitInitializeInstanceFields();
|
||||
[[nodiscard]] bool emitInitializeStaticFields(ListNode* classMembers);
|
||||
|
||||
// To catch accidental misuse, emitUint16Operand/emit3 assert that they are
|
||||
// not used to unconditionally emit JSOP_GETLOCAL. Variable access should
|
||||
// instead be emitted using EmitVarOp. In special cases, when the caller
|
||||
// definitely knows that a given local slot is unaliased, this function may be
|
||||
// used as a non-asserting version of emitUint16Operand.
|
||||
MOZ_MUST_USE bool emitLocalOp(JSOp op, uint32_t slot);
|
||||
[[nodiscard]] bool emitLocalOp(JSOp op, uint32_t slot);
|
||||
|
||||
MOZ_MUST_USE bool emitArgOp(JSOp op, uint16_t slot);
|
||||
MOZ_MUST_USE bool emitEnvCoordOp(JSOp op, EnvironmentCoordinate ec);
|
||||
[[nodiscard]] bool emitArgOp(JSOp op, uint16_t slot);
|
||||
[[nodiscard]] bool emitEnvCoordOp(JSOp op, EnvironmentCoordinate ec);
|
||||
|
||||
MOZ_MUST_USE bool emitGetNameAtLocation(JSAtom* name, const NameLocation& loc);
|
||||
MOZ_MUST_USE bool emitGetName(JSAtom* name) {
|
||||
[[nodiscard]] bool emitGetNameAtLocation(JSAtom* name, const NameLocation& loc);
|
||||
[[nodiscard]] bool emitGetName(JSAtom* name) {
|
||||
return emitGetNameAtLocation(name, lookupName(name));
|
||||
}
|
||||
MOZ_MUST_USE bool emitGetName(ParseNode* pn);
|
||||
[[nodiscard]] bool emitGetName(ParseNode* pn);
|
||||
|
||||
MOZ_MUST_USE bool emitTDZCheckIfNeeded(JSAtom* name, const NameLocation& loc);
|
||||
[[nodiscard]] bool emitTDZCheckIfNeeded(JSAtom* name, const NameLocation& loc);
|
||||
|
||||
MOZ_MUST_USE bool emitNameIncDec(UnaryNode* incDec);
|
||||
[[nodiscard]] bool emitNameIncDec(UnaryNode* incDec);
|
||||
|
||||
MOZ_MUST_USE bool emitDeclarationList(ListNode* declList);
|
||||
MOZ_MUST_USE bool emitSingleDeclaration(ParseNode* declList, ParseNode* decl,
|
||||
[[nodiscard]] bool emitDeclarationList(ListNode* declList);
|
||||
[[nodiscard]] bool emitSingleDeclaration(ParseNode* declList, ParseNode* decl,
|
||||
ParseNode* initializer);
|
||||
|
||||
MOZ_MUST_USE bool emitNewInit(JSProtoKey key);
|
||||
MOZ_MUST_USE bool emitSingletonInitialiser(ParseNode* pn);
|
||||
[[nodiscard]] bool emitNewInit(JSProtoKey key);
|
||||
[[nodiscard]] bool emitSingletonInitialiser(ParseNode* pn);
|
||||
|
||||
MOZ_MUST_USE bool emitPrepareIteratorResult();
|
||||
MOZ_MUST_USE bool emitFinishIteratorResult(bool done);
|
||||
MOZ_MUST_USE bool iteratorResultShape(unsigned* shape);
|
||||
MOZ_MUST_USE bool emitToIteratorResult(bool done);
|
||||
[[nodiscard]] bool emitPrepareIteratorResult();
|
||||
[[nodiscard]] bool emitFinishIteratorResult(bool done);
|
||||
[[nodiscard]] bool iteratorResultShape(unsigned* shape);
|
||||
[[nodiscard]] bool emitToIteratorResult(bool done);
|
||||
|
||||
MOZ_MUST_USE bool emitGetDotGeneratorInInnermostScope() {
|
||||
[[nodiscard]] bool emitGetDotGeneratorInInnermostScope() {
|
||||
return emitGetDotGeneratorInScope(*innermostEmitterScope());
|
||||
}
|
||||
MOZ_MUST_USE bool emitGetDotGeneratorInScope(EmitterScope& currentScope);
|
||||
[[nodiscard]] bool emitGetDotGeneratorInScope(EmitterScope& currentScope);
|
||||
|
||||
MOZ_MUST_USE bool emitInitialYield(UnaryNode* yieldNode);
|
||||
MOZ_MUST_USE bool emitYield(UnaryNode* yieldNode);
|
||||
MOZ_MUST_USE bool emitYieldOp(JSOp op);
|
||||
MOZ_MUST_USE bool emitYieldStar(ParseNode* iter);
|
||||
MOZ_MUST_USE bool emitAwaitInInnermostScope() {
|
||||
[[nodiscard]] bool emitInitialYield(UnaryNode* yieldNode);
|
||||
[[nodiscard]] bool emitYield(UnaryNode* yieldNode);
|
||||
[[nodiscard]] bool emitYieldOp(JSOp op);
|
||||
[[nodiscard]] bool emitYieldStar(ParseNode* iter);
|
||||
[[nodiscard]] bool emitAwaitInInnermostScope() {
|
||||
return emitAwaitInScope(*innermostEmitterScope());
|
||||
}
|
||||
MOZ_MUST_USE bool emitAwaitInInnermostScope(UnaryNode* awaitNode);
|
||||
MOZ_MUST_USE bool emitAwaitInScope(EmitterScope& currentScope);
|
||||
MOZ_MUST_USE bool emitPropLHS(PropertyAccess* prop);
|
||||
MOZ_MUST_USE bool emitPropIncDec(UnaryNode* incDec);
|
||||
[[nodiscard]] bool emitAwaitInInnermostScope(UnaryNode* awaitNode);
|
||||
[[nodiscard]] bool emitAwaitInScope(EmitterScope& currentScope);
|
||||
[[nodiscard]] bool emitPropLHS(PropertyAccess* prop);
|
||||
[[nodiscard]] bool emitPropIncDec(UnaryNode* incDec);
|
||||
|
||||
MOZ_MUST_USE bool emitAsyncWrapperLambda(unsigned index, bool isArrow);
|
||||
MOZ_MUST_USE bool emitAsyncWrapper(unsigned index, bool needsHomeObject, bool isArrow,
|
||||
[[nodiscard]] bool emitAsyncWrapperLambda(unsigned index, bool isArrow);
|
||||
[[nodiscard]] bool emitAsyncWrapper(unsigned index, bool needsHomeObject, bool isArrow,
|
||||
bool isStarGenerator);
|
||||
|
||||
MOZ_MUST_USE bool emitComputedPropertyName(UnaryNode* computedPropName);
|
||||
[[nodiscard]] bool emitComputedPropertyName(UnaryNode* computedPropName);
|
||||
|
||||
// Emit bytecode to put operands for a JSOP_GETELEM/CALLELEM/SETELEM/DELELEM
|
||||
// opcode onto the stack in the right order. In the case of SETELEM, the
|
||||
// value to be assigned must already be pushed.
|
||||
enum class EmitElemOption { Get, Set, Call, IncDec, CompoundAssign, Ref };
|
||||
MOZ_MUST_USE bool emitElemOperands(PropertyByValue* elem, EmitElemOption opts);
|
||||
[[nodiscard]] bool emitElemOperands(PropertyByValue* elem, EmitElemOption opts);
|
||||
|
||||
MOZ_MUST_USE bool emitElemObjAndKey(PropertyByValue* elem, bool isSuper, ElemOpEmitter& eoe);
|
||||
MOZ_MUST_USE bool emitElemOpBase(JSOp op);
|
||||
MOZ_MUST_USE bool emitElemIncDec(UnaryNode* incDec);
|
||||
[[nodiscard]] bool emitElemObjAndKey(PropertyByValue* elem, bool isSuper, ElemOpEmitter& eoe);
|
||||
[[nodiscard]] bool emitElemOpBase(JSOp op);
|
||||
[[nodiscard]] bool emitElemIncDec(UnaryNode* incDec);
|
||||
|
||||
MOZ_MUST_USE bool emitCatch(TernaryNode* catchNode);
|
||||
MOZ_MUST_USE bool emitIf(TernaryNode* ifNode);
|
||||
MOZ_MUST_USE bool emitWith(BinaryNode* withNode);
|
||||
[[nodiscard]] bool emitCatch(TernaryNode* catchNode);
|
||||
[[nodiscard]] bool emitIf(TernaryNode* ifNode);
|
||||
[[nodiscard]] bool emitWith(BinaryNode* withNode);
|
||||
|
||||
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitLabeledStatement(const LabeledStatement* pn);
|
||||
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitLexicalScope(LexicalScopeNode* lexicalScope);
|
||||
MOZ_MUST_USE bool emitLexicalScopeBody(ParseNode* body,
|
||||
[[nodiscard]] MOZ_NEVER_INLINE bool emitLabeledStatement(const LabeledStatement* pn);
|
||||
[[nodiscard]] MOZ_NEVER_INLINE bool emitLexicalScope(LexicalScopeNode* lexicalScope);
|
||||
[[nodiscard]] bool emitLexicalScopeBody(ParseNode* body,
|
||||
EmitLineNumberNote emitLineNote = EMIT_LINENOTE);
|
||||
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitSwitch(SwitchStatement* switchStmt);
|
||||
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitTry(TryNode* tryNode);
|
||||
[[nodiscard]] MOZ_NEVER_INLINE bool emitSwitch(SwitchStatement* switchStmt);
|
||||
[[nodiscard]] MOZ_NEVER_INLINE bool emitTry(TryNode* tryNode);
|
||||
|
||||
// emitDestructuringLHSRef emits the lhs expression's reference.
|
||||
// If the lhs expression is object property |OBJ.prop|, it emits |OBJ|.
|
||||
// If it's object element |OBJ[ELEM]|, it emits |OBJ| and |ELEM|.
|
||||
// If there's nothing to evaluate for the reference, it emits nothing.
|
||||
// |emitted| parameter receives the number of values pushed onto the stack.
|
||||
MOZ_MUST_USE bool emitDestructuringLHSRef(ParseNode* target, size_t* emitted);
|
||||
[[nodiscard]] bool emitDestructuringLHSRef(ParseNode* target, size_t* emitted);
|
||||
|
||||
// emitSetOrInitializeDestructuring assumes the lhs expression's reference
|
||||
// and the to-be-destructured value has been pushed on the stack. It emits
|
||||
// code to destructure a single lhs expression (either a name or a compound
|
||||
// []/{} expression).
|
||||
MOZ_MUST_USE bool emitSetOrInitializeDestructuring(ParseNode* target, DestructuringFlavor flav);
|
||||
[[nodiscard]] bool emitSetOrInitializeDestructuring(ParseNode* target, DestructuringFlavor flav);
|
||||
|
||||
// emitDestructuringObjRestExclusionSet emits the property exclusion set
|
||||
// for the rest-property in an object pattern.
|
||||
MOZ_MUST_USE bool emitDestructuringObjRestExclusionSet(ListNode* pattern);
|
||||
[[nodiscard]] bool emitDestructuringObjRestExclusionSet(ListNode* pattern);
|
||||
|
||||
// emitDestructuringOps assumes the to-be-destructured value has been
|
||||
// pushed on the stack and emits code to destructure each part of a [] or
|
||||
// {} lhs expression.
|
||||
MOZ_MUST_USE bool emitDestructuringOps(ListNode* pattern, DestructuringFlavor flav);
|
||||
MOZ_MUST_USE bool emitDestructuringOpsArray(ListNode* pattern, DestructuringFlavor flav);
|
||||
MOZ_MUST_USE bool emitDestructuringOpsObject(ListNode* pattern, DestructuringFlavor flav);
|
||||
[[nodiscard]] bool emitDestructuringOps(ListNode* pattern, DestructuringFlavor flav);
|
||||
[[nodiscard]] bool emitDestructuringOpsArray(ListNode* pattern, DestructuringFlavor flav);
|
||||
[[nodiscard]] bool emitDestructuringOpsObject(ListNode* pattern, DestructuringFlavor flav);
|
||||
|
||||
typedef bool
|
||||
(*DestructuringDeclEmitter)(BytecodeEmitter* bce, ParseNode* pn);
|
||||
|
||||
// Throw a TypeError if the value atop the stack isn't convertible to an
|
||||
// object, with no overall effect on the stack.
|
||||
MOZ_MUST_USE bool emitRequireObjectCoercible();
|
||||
[[nodiscard]] bool emitRequireObjectCoercible();
|
||||
|
||||
enum class CopyOption {
|
||||
Filtered, Unfiltered
|
||||
@@ -658,27 +658,27 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
// Calls either the |CopyDataProperties| or the
|
||||
// |CopyDataPropertiesUnfiltered| intrinsic function, consumes three (or
|
||||
// two in the latter case) elements from the stack.
|
||||
MOZ_MUST_USE bool emitCopyDataProperties(CopyOption option);
|
||||
[[nodiscard]] bool emitCopyDataProperties(CopyOption option);
|
||||
|
||||
// emitIterator expects the iterable to already be on the stack.
|
||||
// It will replace that stack value with the corresponding iterator
|
||||
MOZ_MUST_USE bool emitIterator();
|
||||
[[nodiscard]] bool emitIterator();
|
||||
|
||||
MOZ_MUST_USE bool emitAsyncIterator();
|
||||
[[nodiscard]] bool emitAsyncIterator();
|
||||
|
||||
// XXX currently used only by OptionalEmitter, research still required
|
||||
// to identify when this was introduced in m-c.
|
||||
MOZ_MUST_USE bool emitPushNotUndefinedOrNull();
|
||||
[[nodiscard]] bool emitPushNotUndefinedOrNull();
|
||||
|
||||
// Pops iterator from the top of the stack. Pushes the result of |.next()|
|
||||
// onto the stack.
|
||||
MOZ_MUST_USE bool emitIteratorNext(ParseNode* pn, IteratorKind kind = IteratorKind::Sync,
|
||||
[[nodiscard]] bool emitIteratorNext(ParseNode* pn, IteratorKind kind = IteratorKind::Sync,
|
||||
bool allowSelfHosted = false);
|
||||
MOZ_MUST_USE bool emitIteratorCloseInScope(EmitterScope& currentScope,
|
||||
[[nodiscard]] bool emitIteratorCloseInScope(EmitterScope& currentScope,
|
||||
IteratorKind iterKind = IteratorKind::Sync,
|
||||
CompletionKind completionKind = CompletionKind::Normal,
|
||||
bool allowSelfHosted = false);
|
||||
MOZ_MUST_USE bool emitIteratorCloseInInnermostScope(IteratorKind iterKind = IteratorKind::Sync,
|
||||
[[nodiscard]] bool emitIteratorCloseInInnermostScope(IteratorKind iterKind = IteratorKind::Sync,
|
||||
CompletionKind completionKind = CompletionKind::Normal,
|
||||
bool allowSelfHosted = false) {
|
||||
return emitIteratorCloseInScope(*innermostEmitterScope(), iterKind, completionKind,
|
||||
@@ -686,7 +686,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
}
|
||||
|
||||
template <typename InnerEmitter>
|
||||
MOZ_MUST_USE bool wrapWithDestructuringIteratorCloseTryNote(int32_t iterDepth,
|
||||
[[nodiscard]] bool wrapWithDestructuringIteratorCloseTryNote(int32_t iterDepth,
|
||||
InnerEmitter emitter);
|
||||
|
||||
// Check if the value on top of the stack is "undefined". If so, replace
|
||||
@@ -694,114 +694,114 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
// |pattern| is a lhs node of the default expression. If it's an
|
||||
// identifier and |defaultExpr| is an anonymous function, |SetFunctionName|
|
||||
// is called at compile time.
|
||||
MOZ_MUST_USE bool emitDefault(ParseNode* defaultExpr, ParseNode* pattern);
|
||||
[[nodiscard]] bool emitDefault(ParseNode* defaultExpr, ParseNode* pattern);
|
||||
|
||||
MOZ_MUST_USE bool setOrEmitSetFunName(ParseNode* maybeFun, HandleAtom name);
|
||||
MOZ_MUST_USE bool setFunName(JSFunction* fun, JSAtom* name);
|
||||
MOZ_MUST_USE bool emitSetClassConstructorName(JSAtom* name);
|
||||
MOZ_MUST_USE bool emitSetFunctionNameFromStack(uint8_t offset);
|
||||
[[nodiscard]] bool setOrEmitSetFunName(ParseNode* maybeFun, HandleAtom name);
|
||||
[[nodiscard]] bool setFunName(JSFunction* fun, JSAtom* name);
|
||||
[[nodiscard]] bool emitSetClassConstructorName(JSAtom* name);
|
||||
[[nodiscard]] bool emitSetFunctionNameFromStack(uint8_t offset);
|
||||
|
||||
MOZ_MUST_USE bool emitInitializer(ParseNode* initializer, ParseNode* pattern);
|
||||
[[nodiscard]] bool emitInitializer(ParseNode* initializer, ParseNode* pattern);
|
||||
|
||||
MOZ_MUST_USE bool emitCallSiteObject(CallSiteNode* callSiteObj);
|
||||
MOZ_MUST_USE bool emitTemplateString(ListNode* templateString);
|
||||
MOZ_MUST_USE bool emitAssignmentOrInit(ParseNodeKind kind, JSOp compoundOp,
|
||||
[[nodiscard]] bool emitCallSiteObject(CallSiteNode* callSiteObj);
|
||||
[[nodiscard]] bool emitTemplateString(ListNode* templateString);
|
||||
[[nodiscard]] bool emitAssignmentOrInit(ParseNodeKind kind, JSOp compoundOp,
|
||||
ParseNode* lhs, ParseNode* rhs);
|
||||
MOZ_MUST_USE bool emitShortCircuitAssignment(ParseNodeKind kind, JSOp op,
|
||||
[[nodiscard]] bool emitShortCircuitAssignment(ParseNodeKind kind, JSOp op,
|
||||
ParseNode* lhs, ParseNode* rhs);
|
||||
|
||||
MOZ_MUST_USE bool emitReturn(UnaryNode* returnNode);
|
||||
MOZ_MUST_USE bool emitStatement(UnaryNode* exprStmt);
|
||||
MOZ_MUST_USE bool emitStatementList(ListNode* stmtList);
|
||||
[[nodiscard]] bool emitReturn(UnaryNode* returnNode);
|
||||
[[nodiscard]] bool emitStatement(UnaryNode* exprStmt);
|
||||
[[nodiscard]] bool emitStatementList(ListNode* stmtList);
|
||||
|
||||
MOZ_MUST_USE bool emitDeleteName(UnaryNode* deleteNode);
|
||||
MOZ_MUST_USE bool emitDeleteProperty(UnaryNode* deleteNode);
|
||||
MOZ_MUST_USE bool emitDeleteElement(UnaryNode* deleteNode);
|
||||
MOZ_MUST_USE bool emitDeleteExpression(UnaryNode* deleteNode);
|
||||
[[nodiscard]] bool emitDeleteName(UnaryNode* deleteNode);
|
||||
[[nodiscard]] bool emitDeleteProperty(UnaryNode* deleteNode);
|
||||
[[nodiscard]] bool emitDeleteElement(UnaryNode* deleteNode);
|
||||
[[nodiscard]] bool emitDeleteExpression(UnaryNode* deleteNode);
|
||||
|
||||
// Optional methods which emit Optional Jump Target
|
||||
MOZ_MUST_USE bool emitOptionalChain(UnaryNode* optionalChain,
|
||||
[[nodiscard]] bool emitOptionalChain(UnaryNode* optionalChain,
|
||||
ValueUsage valueUsage);
|
||||
MOZ_MUST_USE bool emitCalleeAndThisForOptionalChain(UnaryNode* optionalChain,
|
||||
[[nodiscard]] bool emitCalleeAndThisForOptionalChain(UnaryNode* optionalChain,
|
||||
ParseNode* callNode,
|
||||
CallOrNewEmitter& cone);
|
||||
MOZ_MUST_USE bool emitDeleteOptionalChain(UnaryNode* deleteNode);
|
||||
[[nodiscard]] bool emitDeleteOptionalChain(UnaryNode* deleteNode);
|
||||
|
||||
// Optional methods which emit a shortCircuit jump. They need to be called by
|
||||
// a method which emits an Optional Jump Target, see below.
|
||||
MOZ_MUST_USE bool emitOptionalDotExpression(PropertyAccessBase* prop,
|
||||
[[nodiscard]] bool emitOptionalDotExpression(PropertyAccessBase* prop,
|
||||
PropOpEmitter& poe, bool isSuper,
|
||||
OptionalEmitter& oe);
|
||||
MOZ_MUST_USE bool emitOptionalElemExpression(PropertyByValueBase* elem,
|
||||
[[nodiscard]] bool emitOptionalElemExpression(PropertyByValueBase* elem,
|
||||
ElemOpEmitter& eoe, bool isSuper,
|
||||
OptionalEmitter& oe);
|
||||
MOZ_MUST_USE bool emitOptionalCall(BinaryNode* callNode,
|
||||
[[nodiscard]] bool emitOptionalCall(BinaryNode* callNode,
|
||||
OptionalEmitter& oe,
|
||||
ValueUsage valueUsage);
|
||||
MOZ_MUST_USE bool emitDeletePropertyInOptChain(PropertyAccessBase* propExpr,
|
||||
[[nodiscard]] bool emitDeletePropertyInOptChain(PropertyAccessBase* propExpr,
|
||||
OptionalEmitter& oe);
|
||||
MOZ_MUST_USE bool emitDeleteElementInOptChain(PropertyByValueBase* elemExpr,
|
||||
[[nodiscard]] bool emitDeleteElementInOptChain(PropertyByValueBase* elemExpr,
|
||||
OptionalEmitter& oe);
|
||||
|
||||
// |op| must be JSOP_TYPEOF or JSOP_TYPEOFEXPR.
|
||||
MOZ_MUST_USE bool emitTypeof(UnaryNode* typeofNode, JSOp op);
|
||||
[[nodiscard]] bool emitTypeof(UnaryNode* typeofNode, JSOp op);
|
||||
|
||||
MOZ_MUST_USE bool emitUnary(UnaryNode* unaryNode);
|
||||
MOZ_MUST_USE bool emitRightAssociative(ListNode* node);
|
||||
MOZ_MUST_USE bool emitLeftAssociative(ListNode* node);
|
||||
MOZ_MUST_USE bool emitLogical(ListNode* node);
|
||||
MOZ_MUST_USE bool emitSequenceExpr(ListNode* node,
|
||||
[[nodiscard]] bool emitUnary(UnaryNode* unaryNode);
|
||||
[[nodiscard]] bool emitRightAssociative(ListNode* node);
|
||||
[[nodiscard]] bool emitLeftAssociative(ListNode* node);
|
||||
[[nodiscard]] bool emitLogical(ListNode* node);
|
||||
[[nodiscard]] bool emitSequenceExpr(ListNode* node,
|
||||
ValueUsage valueUsage = ValueUsage::WantValue);
|
||||
|
||||
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitIncOrDec(UnaryNode* incDec);
|
||||
[[nodiscard]] MOZ_NEVER_INLINE bool emitIncOrDec(UnaryNode* incDec);
|
||||
|
||||
MOZ_MUST_USE bool emitConditionalExpression(ConditionalExpression& conditional,
|
||||
[[nodiscard]] bool emitConditionalExpression(ConditionalExpression& conditional,
|
||||
ValueUsage valueUsage = ValueUsage::WantValue);
|
||||
|
||||
MOZ_MUST_USE bool isRestParameter(ParseNode* pn);
|
||||
MOZ_MUST_USE bool emitOptimizeSpread(ParseNode* arg0, JumpList* jmp, bool* emitted);
|
||||
[[nodiscard]] bool isRestParameter(ParseNode* pn);
|
||||
[[nodiscard]] bool emitOptimizeSpread(ParseNode* arg0, JumpList* jmp, bool* emitted);
|
||||
|
||||
MOZ_MUST_USE ParseNode* getCoordNode(ParseNode* callNode, ParseNode* calleeNode,
|
||||
[[nodiscard]] ParseNode* getCoordNode(ParseNode* callNode, ParseNode* calleeNode,
|
||||
ListNode* argsList);
|
||||
MOZ_MUST_USE bool emitArguments(ListNode* argsList, bool isCall, bool isSpread,
|
||||
[[nodiscard]] bool emitArguments(ListNode* argsList, bool isCall, bool isSpread,
|
||||
CallOrNewEmitter& cone);
|
||||
MOZ_MUST_USE bool emitCallOrNew(BinaryNode* pn,
|
||||
[[nodiscard]] bool emitCallOrNew(BinaryNode* pn,
|
||||
ValueUsage valueUsage = ValueUsage::WantValue);
|
||||
MOZ_MUST_USE bool emitCalleeAndThis(ParseNode* callNode,
|
||||
[[nodiscard]] bool emitCalleeAndThis(ParseNode* callNode,
|
||||
ParseNode* calleeNode,
|
||||
CallOrNewEmitter& cone);
|
||||
MOZ_MUST_USE bool emitOptionalCalleeAndThis(ParseNode* callNode,
|
||||
[[nodiscard]] bool emitOptionalCalleeAndThis(ParseNode* callNode,
|
||||
ParseNode* calleeNode,
|
||||
CallOrNewEmitter& cone,
|
||||
OptionalEmitter& oe);
|
||||
|
||||
MOZ_MUST_USE bool emitSelfHostedCallFunction(BinaryNode* callNode);
|
||||
MOZ_MUST_USE bool emitSelfHostedResumeGenerator(BinaryNode* callNode);
|
||||
MOZ_MUST_USE bool emitSelfHostedForceInterpreter(ParseNode* pn);
|
||||
MOZ_MUST_USE bool emitSelfHostedAllowContentIter(BinaryNode* callNode);
|
||||
[[nodiscard]] bool emitSelfHostedCallFunction(BinaryNode* callNode);
|
||||
[[nodiscard]] bool emitSelfHostedResumeGenerator(BinaryNode* callNode);
|
||||
[[nodiscard]] bool emitSelfHostedForceInterpreter(ParseNode* pn);
|
||||
[[nodiscard]] bool emitSelfHostedAllowContentIter(BinaryNode* callNode);
|
||||
|
||||
MOZ_MUST_USE bool emitComprehensionFor(ForNode* forNode);
|
||||
MOZ_MUST_USE bool emitComprehensionForIn(ForNode* forNode);
|
||||
MOZ_MUST_USE bool emitComprehensionForInOrOfVariables(ParseNode* pn, bool* lexicalScope);
|
||||
MOZ_MUST_USE bool emitComprehensionForOf(ForNode* forNode);
|
||||
[[nodiscard]] bool emitComprehensionFor(ForNode* forNode);
|
||||
[[nodiscard]] bool emitComprehensionForIn(ForNode* forNode);
|
||||
[[nodiscard]] bool emitComprehensionForInOrOfVariables(ParseNode* pn, bool* lexicalScope);
|
||||
[[nodiscard]] bool emitComprehensionForOf(ForNode* forNode);
|
||||
|
||||
MOZ_MUST_USE bool emitDo(BinaryNode* doNode);
|
||||
MOZ_MUST_USE bool emitWhile(BinaryNode* whileNode);
|
||||
[[nodiscard]] bool emitDo(BinaryNode* doNode);
|
||||
[[nodiscard]] bool emitWhile(BinaryNode* whileNode);
|
||||
|
||||
MOZ_MUST_USE bool emitFor(ForNode* forNode, const EmitterScope* headLexicalEmitterScope = nullptr);
|
||||
MOZ_MUST_USE bool emitCStyleFor(ForNode* forNode, const EmitterScope* headLexicalEmitterScope);
|
||||
MOZ_MUST_USE bool emitForIn(ForNode* forNode, const EmitterScope* headLexicalEmitterScope);
|
||||
MOZ_MUST_USE bool emitForOf(ForNode* forNode, const EmitterScope* headLexicalEmitterScope);
|
||||
[[nodiscard]] bool emitFor(ForNode* forNode, const EmitterScope* headLexicalEmitterScope = nullptr);
|
||||
[[nodiscard]] bool emitCStyleFor(ForNode* forNode, const EmitterScope* headLexicalEmitterScope);
|
||||
[[nodiscard]] bool emitForIn(ForNode* forNode, const EmitterScope* headLexicalEmitterScope);
|
||||
[[nodiscard]] bool emitForOf(ForNode* forNode, const EmitterScope* headLexicalEmitterScope);
|
||||
|
||||
MOZ_MUST_USE bool emitInitializeForInOrOfTarget(TernaryNode* forHead);
|
||||
[[nodiscard]] bool emitInitializeForInOrOfTarget(TernaryNode* forHead);
|
||||
|
||||
MOZ_MUST_USE bool emitBreak(PropertyName* label);
|
||||
MOZ_MUST_USE bool emitContinue(PropertyName* label);
|
||||
[[nodiscard]] bool emitBreak(PropertyName* label);
|
||||
[[nodiscard]] bool emitContinue(PropertyName* label);
|
||||
|
||||
MOZ_MUST_USE bool emitFunctionFormalParameters(ListNode* paramsBody);
|
||||
MOZ_MUST_USE bool emitInitializeFunctionSpecialNames();
|
||||
MOZ_MUST_USE bool emitLexicalInitialization(NameNode* pn);
|
||||
MOZ_MUST_USE bool emitLexicalInitialization(JSAtom* name);
|
||||
[[nodiscard]] bool emitFunctionFormalParameters(ListNode* paramsBody);
|
||||
[[nodiscard]] bool emitInitializeFunctionSpecialNames();
|
||||
[[nodiscard]] bool emitLexicalInitialization(NameNode* pn);
|
||||
[[nodiscard]] bool emitLexicalInitialization(JSAtom* name);
|
||||
|
||||
// Emit bytecode for the spread operator.
|
||||
//
|
||||
@@ -811,9 +811,9 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
// |.next()| and put the results into the I-th element of array with
|
||||
// incrementing I, then push the result I (it will be original I +
|
||||
// iteration count). The stack after iteration will look like |ARRAY INDEX|.
|
||||
MOZ_MUST_USE bool emitSpread(bool allowSelfHosted = false);
|
||||
[[nodiscard]] bool emitSpread(bool allowSelfHosted = false);
|
||||
|
||||
MOZ_MUST_USE bool emitClass(ClassNode* classNode);
|
||||
[[nodiscard]] bool emitClass(ClassNode* classNode);
|
||||
};
|
||||
|
||||
class MOZ_RAII AutoCheckUnstableEmitterScope {
|
||||
|
||||
Loaded 100 of 358 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user