Commit 8df8477b authored by André Bargull's avatar André Bargull
Browse files

Bug 1716790 - Part 5: Switch parameter order in KeywordToString. r=dminor

Place `JSContext*` as the last argument to indicate this function is infallible.

Most functions which have `JSContext*` as their first argument are fallible, so
a SpiderMonkey convention is to move `JSContext*` as the last parameter for
infallible functions.

Depends on d1180226

Differential Revision: https://phabricator.services.mozilla.com/D118023
parent 11ab0d70
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -146,8 +146,8 @@ void js::PluralRulesObject::finalize(JSFreeOp* fop, JSObject* obj) {
  }
}

static JSString* KeywordToString(JSContext* cx,
                                 mozilla::intl::PluralRules::Keyword keyword) {
static JSString* KeywordToString(mozilla::intl::PluralRules::Keyword keyword,
                                 JSContext* cx) {
  using Keyword = mozilla::intl::PluralRules::Keyword;
  switch (keyword) {
    case Keyword::Zero: {
@@ -299,7 +299,7 @@ bool js::intl_SelectPluralRule(JSContext* cx, unsigned argc, Value* vp) {
    return false;
  }

  JSString* str = KeywordToString(cx, keywordResult.unwrap());
  JSString* str = KeywordToString(keywordResult.unwrap(), cx);
  MOZ_ASSERT(str);

  args.rval().setString(str);
@@ -339,7 +339,7 @@ bool js::intl_GetPluralCategories(JSContext* cx, unsigned argc, Value* vp) {
  }

  for (PluralRules::Keyword keyword : categories.unwrap()) {
    JSString* str = KeywordToString(cx, keyword);
    JSString* str = KeywordToString(keyword, cx);
    MOZ_ASSERT(str);

    if (!NewbornArrayPush(cx, res, StringValue(str))) {