Commit 8f770ad9 authored by jgruber's avatar jgruber Committed by Commit bot

[regexp] Mark functions MUST_USE_RESULT

BUG=v8:5339

Review-Url: https://codereview.chromium.org/2442333002
Cr-Commit-Position: refs/heads/master@{#40545}
parent 5a5ffc63
......@@ -39,10 +39,10 @@ Handle<String> PatternFlags(Isolate* isolate, Handle<JSRegExp> regexp) {
// ES#sec-regexpinitialize
// Runtime Semantics: RegExpInitialize ( obj, pattern, flags )
MaybeHandle<JSRegExp> RegExpInitialize(Isolate* isolate,
Handle<JSRegExp> regexp,
Handle<Object> pattern,
Handle<Object> flags) {
MUST_USE_RESULT MaybeHandle<JSRegExp> RegExpInitialize(Isolate* isolate,
Handle<JSRegExp> regexp,
Handle<Object> pattern,
Handle<Object> flags) {
Handle<String> pattern_string;
if (pattern->IsUndefined(isolate)) {
pattern_string = isolate->factory()->empty_string();
......@@ -1341,9 +1341,9 @@ MaybeHandle<JSArray> RegExpSplit(Isolate* isolate, Handle<JSRegExp> regexp,
// ES##sec-speciesconstructor
// SpeciesConstructor ( O, defaultConstructor )
MaybeHandle<Object> SpeciesConstructor(Isolate* isolate,
Handle<JSReceiver> recv,
Handle<JSFunction> default_ctor) {
MUST_USE_RESULT MaybeHandle<Object> SpeciesConstructor(
Isolate* isolate, Handle<JSReceiver> recv,
Handle<JSFunction> default_ctor) {
Handle<Object> ctor_obj;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, ctor_obj,
......
......@@ -19,16 +19,15 @@ class RegExpUtils : public AllStatic {
int capture, bool* ok = nullptr);
// Last index (RegExp.lastIndex) accessors.
static MaybeHandle<Object> SetLastIndex(Isolate* isolate,
Handle<JSReceiver> regexp, int value);
static MaybeHandle<Object> GetLastIndex(Isolate* isolate,
Handle<JSReceiver> recv);
static MUST_USE_RESULT MaybeHandle<Object> SetLastIndex(
Isolate* isolate, Handle<JSReceiver> regexp, int value);
static MUST_USE_RESULT MaybeHandle<Object> GetLastIndex(
Isolate* isolate, Handle<JSReceiver> recv);
// ES#sec-regexpexec Runtime Semantics: RegExpExec ( R, S )
static MaybeHandle<Object> RegExpExec(Isolate* isolate,
Handle<JSReceiver> regexp,
Handle<String> string,
Handle<Object> exec);
static MUST_USE_RESULT MaybeHandle<Object> RegExpExec(
Isolate* isolate, Handle<JSReceiver> regexp, Handle<String> string,
Handle<Object> exec);
// ES#sec-isregexp IsRegExp ( argument )
// Includes checking of the match property.
......@@ -42,10 +41,9 @@ class RegExpUtils : public AllStatic {
// AdvanceStringIndex ( S, index, unicode )
static int AdvanceStringIndex(Isolate* isolate, Handle<String> string,
int index, bool unicode);
static MaybeHandle<Object> SetAdvancedStringIndex(Isolate* isolate,
Handle<JSReceiver> regexp,
Handle<String> string,
bool unicode);
static MUST_USE_RESULT MaybeHandle<Object> SetAdvancedStringIndex(
Isolate* isolate, Handle<JSReceiver> regexp, Handle<String> string,
bool unicode);
};
} // namespace internal
......
......@@ -1124,7 +1124,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
}
}
MaybeHandle<String> StringReplaceNonGlobalRegExpWithFunction(
MUST_USE_RESULT MaybeHandle<String> StringReplaceNonGlobalRegExpWithFunction(
Isolate* isolate, Handle<String> subject, Handle<JSRegExp> regexp,
Handle<Object> replace_obj) {
Factory* factory = isolate->factory();
......@@ -1193,9 +1193,10 @@ MaybeHandle<String> StringReplaceNonGlobalRegExpWithFunction(
// Legacy implementation of RegExp.prototype[Symbol.replace] which
// doesn't properly call the underlying exec method.
MaybeHandle<String> RegExpReplace(Isolate* isolate, Handle<JSRegExp> regexp,
Handle<String> string,
Handle<Object> replace_obj) {
MUST_USE_RESULT MaybeHandle<String> RegExpReplace(Isolate* isolate,
Handle<JSRegExp> regexp,
Handle<String> string,
Handle<Object> replace_obj) {
Factory* factory = isolate->factory();
// TODO(jgruber): We need the even stricter guarantee of an unmodified
......
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