diff --git a/src/builtins/builtins-regexp.cc b/src/builtins/builtins-regexp.cc index d993e82f2e..894943043c 100644 --- a/src/builtins/builtins-regexp.cc +++ b/src/builtins/builtins-regexp.cc @@ -39,10 +39,10 @@ Handle PatternFlags(Isolate* isolate, Handle regexp) { // ES#sec-regexpinitialize // Runtime Semantics: RegExpInitialize ( obj, pattern, flags ) -MaybeHandle RegExpInitialize(Isolate* isolate, - Handle regexp, - Handle pattern, - Handle flags) { +MUST_USE_RESULT MaybeHandle RegExpInitialize(Isolate* isolate, + Handle regexp, + Handle pattern, + Handle flags) { Handle pattern_string; if (pattern->IsUndefined(isolate)) { pattern_string = isolate->factory()->empty_string(); @@ -1341,9 +1341,9 @@ MaybeHandle RegExpSplit(Isolate* isolate, Handle regexp, // ES##sec-speciesconstructor // SpeciesConstructor ( O, defaultConstructor ) -MaybeHandle SpeciesConstructor(Isolate* isolate, - Handle recv, - Handle default_ctor) { +MUST_USE_RESULT MaybeHandle SpeciesConstructor( + Isolate* isolate, Handle recv, + Handle default_ctor) { Handle ctor_obj; ASSIGN_RETURN_ON_EXCEPTION( isolate, ctor_obj, diff --git a/src/regexp/regexp-utils.h b/src/regexp/regexp-utils.h index 8a5a099182..eff1ed739c 100644 --- a/src/regexp/regexp-utils.h +++ b/src/regexp/regexp-utils.h @@ -19,16 +19,15 @@ class RegExpUtils : public AllStatic { int capture, bool* ok = nullptr); // Last index (RegExp.lastIndex) accessors. - static MaybeHandle SetLastIndex(Isolate* isolate, - Handle regexp, int value); - static MaybeHandle GetLastIndex(Isolate* isolate, - Handle recv); + static MUST_USE_RESULT MaybeHandle SetLastIndex( + Isolate* isolate, Handle regexp, int value); + static MUST_USE_RESULT MaybeHandle GetLastIndex( + Isolate* isolate, Handle recv); // ES#sec-regexpexec Runtime Semantics: RegExpExec ( R, S ) - static MaybeHandle RegExpExec(Isolate* isolate, - Handle regexp, - Handle string, - Handle exec); + static MUST_USE_RESULT MaybeHandle RegExpExec( + Isolate* isolate, Handle regexp, Handle string, + Handle 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, int index, bool unicode); - static MaybeHandle SetAdvancedStringIndex(Isolate* isolate, - Handle regexp, - Handle string, - bool unicode); + static MUST_USE_RESULT MaybeHandle SetAdvancedStringIndex( + Isolate* isolate, Handle regexp, Handle string, + bool unicode); }; } // namespace internal diff --git a/src/runtime/runtime-regexp.cc b/src/runtime/runtime-regexp.cc index 7a89448e11..3101393483 100644 --- a/src/runtime/runtime-regexp.cc +++ b/src/runtime/runtime-regexp.cc @@ -1124,7 +1124,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle subject, } } -MaybeHandle StringReplaceNonGlobalRegExpWithFunction( +MUST_USE_RESULT MaybeHandle StringReplaceNonGlobalRegExpWithFunction( Isolate* isolate, Handle subject, Handle regexp, Handle replace_obj) { Factory* factory = isolate->factory(); @@ -1193,9 +1193,10 @@ MaybeHandle StringReplaceNonGlobalRegExpWithFunction( // Legacy implementation of RegExp.prototype[Symbol.replace] which // doesn't properly call the underlying exec method. -MaybeHandle RegExpReplace(Isolate* isolate, Handle regexp, - Handle string, - Handle replace_obj) { +MUST_USE_RESULT MaybeHandle RegExpReplace(Isolate* isolate, + Handle regexp, + Handle string, + Handle replace_obj) { Factory* factory = isolate->factory(); // TODO(jgruber): We need the even stricter guarantee of an unmodified