Commit bb5fa039 authored by Marja Hölttä's avatar Marja Hölttä Committed by V8 LUCI CQ

[cleanup] Unify variable names "method" & "method_name"

Bug: v8:12244
Change-Id: I9ec30012f7238f53448b80cf9d657571a37502a5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3180822Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77030}
parent ed10210a
......@@ -125,21 +125,21 @@ Object BigIntToStringImpl(Handle<Object> receiver, Handle<Object> radix,
BUILTIN(BigIntPrototypeToLocaleString) {
HandleScope scope(isolate);
const char* method = "BigInt.prototype.toLocaleString";
const char* method_name = "BigInt.prototype.toLocaleString";
#ifdef V8_INTL_SUPPORT
// 1. Let x be ? thisBigIntValue(this value).
Handle<BigInt> x;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, x, ThisBigIntValue(isolate, args.receiver(), method));
isolate, x, ThisBigIntValue(isolate, args.receiver(), method_name));
RETURN_RESULT_OR_FAILURE(
isolate,
Intl::NumberToLocaleString(isolate, x, args.atOrUndefined(isolate, 1),
args.atOrUndefined(isolate, 2), method));
args.atOrUndefined(isolate, 2), method_name));
// Fallbacks to old toString implemention if no V8_INTL_SUPPORT
#endif // V8_INTL_SUPPORT
Handle<Object> radix = isolate->factory()->undefined_value();
return BigIntToStringImpl(args.receiver(), radix, isolate, method);
return BigIntToStringImpl(args.receiver(), radix, isolate, method_name);
}
BUILTIN(BigIntPrototypeToString) {
......
......@@ -775,8 +775,8 @@ BUILTIN(DatePrototypeToLocaleDateString) {
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleDateString);
const char* method = "Date.prototype.toLocaleDateString";
CHECK_RECEIVER(JSDate, date, method);
const char* method_name = "Date.prototype.toLocaleDateString";
CHECK_RECEIVER(JSDate, date, method_name);
RETURN_RESULT_OR_FAILURE(
isolate, JSDateTimeFormat::ToLocaleDateTime(
......@@ -786,7 +786,7 @@ BUILTIN(DatePrototypeToLocaleDateString) {
args.atOrUndefined(isolate, 2), // options
JSDateTimeFormat::RequiredOption::kDate, // required
JSDateTimeFormat::DefaultsOption::kDate, // defaults
method)); // method
method_name)); // method_name
}
// ecma402 #sup-date.prototype.tolocalestring
......@@ -795,8 +795,8 @@ BUILTIN(DatePrototypeToLocaleString) {
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleString);
const char* method = "Date.prototype.toLocaleString";
CHECK_RECEIVER(JSDate, date, method);
const char* method_name = "Date.prototype.toLocaleString";
CHECK_RECEIVER(JSDate, date, method_name);
RETURN_RESULT_OR_FAILURE(
isolate, JSDateTimeFormat::ToLocaleDateTime(
......@@ -806,7 +806,7 @@ BUILTIN(DatePrototypeToLocaleString) {
args.atOrUndefined(isolate, 2), // options
JSDateTimeFormat::RequiredOption::kAny, // required
JSDateTimeFormat::DefaultsOption::kAll, // defaults
method)); // method
method_name)); // method_name
}
// ecma402 #sup-date.prototype.tolocaletimestring
......@@ -815,8 +815,8 @@ BUILTIN(DatePrototypeToLocaleTimeString) {
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateToLocaleTimeString);
const char* method = "Date.prototype.toLocaleTimeString";
CHECK_RECEIVER(JSDate, date, method);
const char* method_name = "Date.prototype.toLocaleTimeString";
CHECK_RECEIVER(JSDate, date, method_name);
RETURN_RESULT_OR_FAILURE(
isolate, JSDateTimeFormat::ToLocaleDateTime(
......@@ -826,7 +826,7 @@ BUILTIN(DatePrototypeToLocaleTimeString) {
args.atOrUndefined(isolate, 2), // options
JSDateTimeFormat::RequiredOption::kTime, // required
JSDateTimeFormat::DefaultsOption::kTime, // defaults
method)); // method
method_name)); // method_name
}
#endif // V8_INTL_SUPPORT
......
This diff is collapsed.
......@@ -111,7 +111,7 @@ BUILTIN(NumberPrototypeToFixed) {
// ES6 section 20.1.3.4 Number.prototype.toLocaleString ( [ r1 [ , r2 ] ] )
BUILTIN(NumberPrototypeToLocaleString) {
HandleScope scope(isolate);
const char* method = "Number.prototype.toLocaleString";
const char* method_name = "Number.prototype.toLocaleString";
isolate->CountUsage(v8::Isolate::UseCounterFeature::kNumberToLocaleString);
......@@ -126,7 +126,7 @@ BUILTIN(NumberPrototypeToLocaleString) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate,
NewTypeError(MessageTemplate::kNotGeneric,
isolate->factory()->NewStringFromAsciiChecked(method),
isolate->factory()->NewStringFromAsciiChecked(method_name),
isolate->factory()->Number_string()));
}
......@@ -134,7 +134,7 @@ BUILTIN(NumberPrototypeToLocaleString) {
RETURN_RESULT_OR_FAILURE(
isolate,
Intl::NumberToLocaleString(isolate, value, args.atOrUndefined(isolate, 1),
args.atOrUndefined(isolate, 2), method));
args.atOrUndefined(isolate, 2), method_name));
#else
// Turn the {value} into a String.
return *isolate->factory()->NumberToString(value);
......
......@@ -47,9 +47,10 @@ BUILTIN(TypedArrayPrototypeCopyWithin) {
HandleScope scope(isolate);
Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.copyWithin";
const char* method_name = "%TypedArray%.prototype.copyWithin";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method));
isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
int64_t len = array->GetLength();
int64_t to = 0;
......@@ -92,7 +93,7 @@ BUILTIN(TypedArrayPrototypeCopyWithin) {
if (out_of_bounds) {
const MessageTemplate message = MessageTemplate::kDetachedOperation;
Handle<String> operation =
isolate->factory()->NewStringFromAsciiChecked(method);
isolate->factory()->NewStringFromAsciiChecked(method_name);
THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewTypeError(message, operation));
}
if (new_len < len) {
......@@ -137,9 +138,10 @@ BUILTIN(TypedArrayPrototypeFill) {
HandleScope scope(isolate);
Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.fill";
const char* method_name = "%TypedArray%.prototype.fill";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method));
isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
ElementsKind kind = array->GetElementsKind();
Handle<Object> obj_value = args.atOrUndefined(isolate, 1);
......@@ -181,7 +183,7 @@ BUILTIN(TypedArrayPrototypeFill) {
if (out_of_bounds) {
const MessageTemplate message = MessageTemplate::kDetachedOperation;
Handle<String> operation =
isolate->factory()->NewStringFromAsciiChecked(method);
isolate->factory()->NewStringFromAsciiChecked(method_name);
THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewTypeError(message, operation));
}
}
......@@ -204,9 +206,10 @@ BUILTIN(TypedArrayPrototypeIncludes) {
HandleScope scope(isolate);
Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.includes";
const char* method_name = "%TypedArray%.prototype.includes";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method));
isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
if (args.length() < 2) return ReadOnlyRoots(isolate).false_value();
......@@ -237,9 +240,10 @@ BUILTIN(TypedArrayPrototypeIndexOf) {
HandleScope scope(isolate);
Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.indexOf";
const char* method_name = "%TypedArray%.prototype.indexOf";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method));
isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
int64_t len = array->length();
if (len == 0) return Smi::FromInt(-1);
......@@ -267,9 +271,10 @@ BUILTIN(TypedArrayPrototypeLastIndexOf) {
HandleScope scope(isolate);
Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.lastIndexOf";
const char* method_name = "%TypedArray%.prototype.lastIndexOf";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method));
isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
int64_t len = array->length();
if (len == 0) return Smi::FromInt(-1);
......@@ -301,9 +306,10 @@ BUILTIN(TypedArrayPrototypeReverse) {
HandleScope scope(isolate);
Handle<JSTypedArray> array;
const char* method = "%TypedArray%.prototype.reverse";
const char* method_name = "%TypedArray%.prototype.reverse";
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, array, JSTypedArray::Validate(isolate, args.receiver(), method));
isolate, array,
JSTypedArray::Validate(isolate, args.receiver(), method_name));
ElementsAccessor* elements = array->GetElementsAccessor();
elements->Reverse(*array);
......
......@@ -183,12 +183,12 @@ const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat,
template <typename T>
MaybeHandle<T> New(Isolate* isolate, Handle<JSFunction> constructor,
Handle<Object> locales, Handle<Object> options,
const char* method) {
const char* method_name) {
Handle<Map> map;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, map,
JSFunction::GetDerivedMap(isolate, constructor, constructor), T);
return T::New(isolate, map, locales, options, method);
return T::New(isolate, map, locales, options, method_name);
}
} // namespace
......@@ -927,7 +927,7 @@ MaybeHandle<String> Intl::StringLocaleConvertCase(Isolate* isolate,
base::Optional<int> Intl::StringLocaleCompare(
Isolate* isolate, Handle<String> string1, Handle<String> string2,
Handle<Object> locales, Handle<Object> options, const char* method) {
Handle<Object> locales, Handle<Object> options, const char* method_name) {
// We only cache the instance when locales is a string/undefined and
// options is undefined, as that is the only case when the specified
// side-effects of examining those arguments are unobservable.
......@@ -952,7 +952,7 @@ base::Optional<int> Intl::StringLocaleCompare(
Handle<JSCollator> collator;
MaybeHandle<JSCollator> maybe_collator =
New<JSCollator>(isolate, constructor, locales, options, method);
New<JSCollator>(isolate, constructor, locales, options, method_name);
if (!maybe_collator.ToHandle(&collator)) return {};
if (can_cache) {
isolate->set_icu_object_in_cache(
......@@ -1005,7 +1005,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
Handle<Object> num,
Handle<Object> locales,
Handle<Object> options,
const char* method) {
const char* method_name) {
Handle<Object> numeric_obj;
ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj,
Object::ToNumeric(isolate, num), String);
......@@ -1035,7 +1035,7 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
// 2. Let numberFormat be ? Construct(%NumberFormat%, « locales, options »).
ASSIGN_RETURN_ON_EXCEPTION(
isolate, number_format,
New<JSNumberFormat>(isolate, constructor, locales, options, method),
New<JSNumberFormat>(isolate, constructor, locales, options, method_name),
String);
if (can_cache) {
......@@ -1482,21 +1482,21 @@ MaybeHandle<JSArray> CreateArrayFromList(Isolate* isolate,
// ECMA 402 9.2.9 SupportedLocales(availableLocales, requestedLocales, options)
// https://tc39.github.io/ecma402/#sec-supportedlocales
MaybeHandle<JSObject> SupportedLocales(
Isolate* isolate, const char* method,
Isolate* isolate, const char* method_name,
const std::set<std::string>& available_locales,
const std::vector<std::string>& requested_locales, Handle<Object> options) {
std::vector<std::string> supported_locales;
// 1. Set options to ? CoerceOptionsToObject(options).
Handle<JSReceiver> options_obj;
ASSIGN_RETURN_ON_EXCEPTION(isolate, options_obj,
CoerceOptionsToObject(isolate, options, method),
JSObject);
ASSIGN_RETURN_ON_EXCEPTION(
isolate, options_obj,
CoerceOptionsToObject(isolate, options, method_name), JSObject);
// 2. Let matcher be ? GetOption(options, "localeMatcher", "string",
// « "lookup", "best fit" », "best fit").
Maybe<Intl::MatcherOption> maybe_locale_matcher =
Intl::GetLocaleMatcher(isolate, options_obj, method);
Intl::GetLocaleMatcher(isolate, options_obj, method_name);
MAYBE_RETURN(maybe_locale_matcher, MaybeHandle<JSObject>());
Intl::MatcherOption matcher = maybe_locale_matcher.FromJust();
......@@ -1676,7 +1676,7 @@ MaybeHandle<JSArray> Intl::SupportedValuesOf(Isolate* isolate,
// ECMA 402 Intl.*.supportedLocalesOf
MaybeHandle<JSObject> Intl::SupportedLocalesOf(
Isolate* isolate, const char* method,
Isolate* isolate, const char* method_name,
const std::set<std::string>& available_locales, Handle<Object> locales,
Handle<Object> options) {
// Let availableLocales be %Collator%.[[AvailableLocales]].
......@@ -1687,7 +1687,7 @@ MaybeHandle<JSObject> Intl::SupportedLocalesOf(
MAYBE_RETURN(requested_locales, MaybeHandle<JSObject>());
// Return ? SupportedLocales(availableLocales, requestedLocales, options).
return SupportedLocales(isolate, method, available_locales,
return SupportedLocales(isolate, method_name, available_locales,
requested_locales.FromJust(), options);
}
......@@ -2098,20 +2098,20 @@ base::TimezoneCache* Intl::CreateTimeZoneCache() {
Maybe<Intl::MatcherOption> Intl::GetLocaleMatcher(Isolate* isolate,
Handle<JSReceiver> options,
const char* method) {
const char* method_name) {
return GetStringOption<Intl::MatcherOption>(
isolate, options, "localeMatcher", method, {"best fit", "lookup"},
isolate, options, "localeMatcher", method_name, {"best fit", "lookup"},
{Intl::MatcherOption::kBestFit, Intl::MatcherOption::kLookup},
Intl::MatcherOption::kBestFit);
}
Maybe<bool> Intl::GetNumberingSystem(Isolate* isolate,
Handle<JSReceiver> options,
const char* method,
const char* method_name,
std::unique_ptr<char[]>* result) {
const std::vector<const char*> empty_values = {};
Maybe<bool> maybe = GetStringOption(isolate, options, "numberingSystem",
empty_values, method, result);
empty_values, method_name, result);
MAYBE_RETURN(maybe, Nothing<bool>());
if (maybe.FromJust() && *result != nullptr) {
if (!IsWellFormedNumberingSystem(result->get())) {
......
......@@ -62,7 +62,7 @@ class Intl {
static std::string GetNumberingSystem(const icu::Locale& icu_locale);
static V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> SupportedLocalesOf(
Isolate* isolate, const char* method,
Isolate* isolate, const char* method_name,
const std::set<std::string>& available_locales, Handle<Object> locales_in,
Handle<Object> options_in);
......@@ -94,7 +94,7 @@ class Intl {
V8_WARN_UNUSED_RESULT static base::Optional<int> StringLocaleCompare(
Isolate* isolate, Handle<String> s1, Handle<String> s2,
Handle<Object> locales, Handle<Object> options, const char* method);
Handle<Object> locales, Handle<Object> options, const char* method_name);
V8_WARN_UNUSED_RESULT static int CompareStrings(Isolate* isolate,
const icu::Collator& collator,
......@@ -104,7 +104,7 @@ class Intl {
// ecma402/#sup-properties-of-the-number-prototype-object
V8_WARN_UNUSED_RESULT static MaybeHandle<String> NumberToLocaleString(
Isolate* isolate, Handle<Object> num, Handle<Object> locales,
Handle<Object> options, const char* method);
Handle<Object> options, const char* method_name);
// ecma402/#sec-setnfdigitoptions
struct NumberFormatDigitOptions {
......@@ -172,11 +172,11 @@ class Intl {
// Shared function to read the "localeMatcher" option.
V8_WARN_UNUSED_RESULT static Maybe<MatcherOption> GetLocaleMatcher(
Isolate* isolate, Handle<JSReceiver> options, const char* method);
Isolate* isolate, Handle<JSReceiver> options, const char* method_name);
// Shared function to read the "numberingSystem" option.
V8_WARN_UNUSED_RESULT static Maybe<bool> GetNumberingSystem(
Isolate* isolate, Handle<JSReceiver> options, const char* method,
Isolate* isolate, Handle<JSReceiver> options, const char* method_name,
std::unique_ptr<char[]>* result);
// Check the calendar is valid or not for that locale.
......
......@@ -44,9 +44,9 @@ enum class Sensitivity {
enum class CaseFirst { kUndefined, kUpper, kLower, kFalse };
Maybe<CaseFirst> GetCaseFirst(Isolate* isolate, Handle<JSReceiver> options,
const char* method) {
const char* method_name) {
return GetStringOption<CaseFirst>(
isolate, options, "caseFirst", method, {"upper", "lower", "false"},
isolate, options, "caseFirst", method_name, {"upper", "lower", "false"},
{CaseFirst::kUpper, CaseFirst::kLower, CaseFirst::kFalse},
CaseFirst::kUndefined);
}
......
......@@ -77,9 +77,9 @@ JSDateTimeFormat::HourCycle ToHourCycle(UDateFormatHourCycle hc) {
Maybe<JSDateTimeFormat::HourCycle> GetHourCycle(Isolate* isolate,
Handle<JSReceiver> options,
const char* method) {
const char* method_name) {
return GetStringOption<JSDateTimeFormat::HourCycle>(
isolate, options, "hourCycle", method, {"h11", "h12", "h23", "h24"},
isolate, options, "hourCycle", method_name, {"h11", "h12", "h23", "h24"},
{JSDateTimeFormat::HourCycle::kH11, JSDateTimeFormat::HourCycle::kH12,
JSDateTimeFormat::HourCycle::kH23, JSDateTimeFormat::HourCycle::kH24},
JSDateTimeFormat::HourCycle::kUndefined);
......@@ -772,7 +772,7 @@ Isolate::ICUObjectCacheType ConvertToCacheType(
MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime(
Isolate* isolate, Handle<Object> date, Handle<Object> locales,
Handle<Object> options, RequiredOption required, DefaultsOption defaults,
const char* method) {
const char* method_name) {
Isolate::ICUObjectCacheType cache_type = ConvertToCacheType(defaults);
Factory* factory = isolate->factory();
......@@ -822,7 +822,8 @@ MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime(
Handle<JSDateTimeFormat> date_time_format;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, date_time_format,
JSDateTimeFormat::New(isolate, map, locales, internal_options, method),
JSDateTimeFormat::New(isolate, map, locales, internal_options,
method_name),
String);
if (can_cache) {
......
......@@ -82,7 +82,7 @@ class JSDateTimeFormat
V8_WARN_UNUSED_RESULT static MaybeHandle<String> ToLocaleDateTime(
Isolate* isolate, Handle<Object> date, Handle<Object> locales,
Handle<Object> options, RequiredOption required, DefaultsOption defaults,
const char* method);
const char* method_name);
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
......
......@@ -13,7 +13,7 @@ namespace internal {
// ecma402/#sec-getoptionsobject
MaybeHandle<JSReceiver> GetOptionsObject(Isolate* isolate,
Handle<Object> options,
const char* method) {
const char* method_name) {
// 1. If options is undefined, then
if (options->IsUndefined(isolate)) {
// a. Return ! ObjectCreate(null).
......@@ -32,21 +32,23 @@ MaybeHandle<JSReceiver> GetOptionsObject(Isolate* isolate,
// ecma402/#sec-coerceoptionstoobject
MaybeHandle<JSReceiver> CoerceOptionsToObject(Isolate* isolate,
Handle<Object> options,
const char* method) {
const char* method_name) {
// 1. If options is undefined, then
if (options->IsUndefined(isolate)) {
// a. Return ! ObjectCreate(null).
return isolate->factory()->NewJSObjectWithNullProto();
}
// 2. Return ? ToObject(options).
ASSIGN_RETURN_ON_EXCEPTION(
isolate, options, Object::ToObject(isolate, options, method), JSReceiver);
ASSIGN_RETURN_ON_EXCEPTION(isolate, options,
Object::ToObject(isolate, options, method_name),
JSReceiver);
return Handle<JSReceiver>::cast(options);
}
Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options,
const char* property,
std::vector<const char*> values, const char* method,
std::vector<const char*> values,
const char* method_name,
std::unique_ptr<char[]>* result) {
Handle<String> property_str =
isolate->factory()->NewStringFromAsciiChecked(property);
......@@ -81,7 +83,7 @@ Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options,
}
Handle<String> method_str =
isolate->factory()->NewStringFromAsciiChecked(method);
isolate->factory()->NewStringFromAsciiChecked(method_name);
THROW_NEW_ERROR_RETURN_VALUE(
isolate,
NewRangeError(MessageTemplate::kValueOutOfRange, value, method_str,
......@@ -97,7 +99,7 @@ Maybe<bool> GetStringOption(Isolate* isolate, Handle<JSReceiver> options,
V8_WARN_UNUSED_RESULT Maybe<bool> GetBoolOption(Isolate* isolate,
Handle<JSReceiver> options,
const char* property,
const char* method,
const char* method_name,
bool* result) {
Handle<String> property_str =
isolate->factory()->NewStringFromAsciiChecked(property);
......
......@@ -13,11 +13,11 @@ namespace internal {
// ecma402/#sec-getoptionsobject and temporal/#sec-getoptionsobject
V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> GetOptionsObject(
Isolate* isolate, Handle<Object> options, const char* method);
Isolate* isolate, Handle<Object> options, const char* method_name);
// ecma402/#sec-coerceoptionstoobject
V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> CoerceOptionsToObject(
Isolate* isolate, Handle<Object> options, const char* method);
Isolate* isolate, Handle<Object> options, const char* method_name);
// ECMA402 9.2.10. GetOption( options, property, type, values, fallback)
// ecma402/#sec-getoption and temporal/#sec-getoption
......@@ -32,11 +32,11 @@ V8_WARN_UNUSED_RESULT MaybeHandle<JSReceiver> CoerceOptionsToObject(
// caller is required to use fallback value appropriately in this
// case.
//
// method is a string denoting the method the call from; used when
// method_name is a string denoting the method the call from; used when
// printing the error message.
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetStringOption(
Isolate* isolate, Handle<JSReceiver> options, const char* property,
std::vector<const char*> values, const char* method,
std::vector<const char*> values, const char* method_name,
std::unique_ptr<char[]>* result);
// A helper template to get string from option into a enum.
......@@ -46,12 +46,12 @@ V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetStringOption(
template <typename T>
V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOption(
Isolate* isolate, Handle<JSReceiver> options, const char* name,
const char* method, const std::vector<const char*>& str_values,
const char* method_name, const std::vector<const char*>& str_values,
const std::vector<T>& enum_values, T default_value) {
DCHECK_EQ(str_values.size(), enum_values.size());
std::unique_ptr<char[]> cstr;
Maybe<bool> found =
GetStringOption(isolate, options, name, str_values, method, &cstr);
GetStringOption(isolate, options, name, str_values, method_name, &cstr);
MAYBE_RETURN(found, Nothing<T>());
if (found.FromJust()) {
DCHECK_NOT_NULL(cstr.get());
......@@ -75,11 +75,11 @@ V8_WARN_UNUSED_RESULT static Maybe<T> GetStringOption(
// caller is required to use fallback value appropriately in this
// case.
//
// method is a string denoting the method it called from; used when
// method_name is a string denoting the method it called from; used when
// printing the error message.
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<bool> GetBoolOption(
Isolate* isolate, Handle<JSReceiver> options, const char* property,
const char* method, bool* result);
const char* method_name, bool* result);
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT Maybe<int> GetNumberOption(
Isolate* isolate, Handle<JSReceiver> options, Handle<String> property,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment