1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibJS: Implement and use the GetSubstitution abstract operation

Used by String.prototype.replace, String.prototype.replaceAll, and
RegExp.prototype [ @@replace ].
This commit is contained in:
Timothy Flynn 2021-07-05 16:16:48 -04:00 committed by Linus Groh
parent 4985d3ef42
commit e0c9f58b0c
5 changed files with 129 additions and 6 deletions

View file

@ -30,6 +30,7 @@ Object* get_prototype_from_constructor(GlobalObject&, FunctionObject const& cons
Object* create_unmapped_arguments_object(GlobalObject&, Vector<Value> const& arguments);
Object* create_mapped_arguments_object(GlobalObject&, FunctionObject&, Vector<FunctionNode::Parameter> const&, Vector<Value> const& arguments, Environment&);
Value canonical_numeric_index_string(GlobalObject&, PropertyName const&);
String get_substitution(GlobalObject&, String const& matched, String const& str, size_t position, Vector<Value> const& captures, Value named_captures, Value replacement);
enum class CallerMode {
Strict,