From 438e3ceb4a407a9718e51521ea15bcb88d1b373c Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 3 May 2022 21:19:16 +0200 Subject: LibJS: Use CreateDataPropertyOrThrow in MakeMatchIndicesIndexPairArray This was part of a normative change in the ECMA-262 spec, but didn't get updated when we implemented that. See: https://github.com/tc39/ecma262/commit/0209d85 --- Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Userland/Libraries/LibJS') diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index 4f5ce2c2c3..7a42c95f88 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -141,21 +141,21 @@ static Value make_match_indices_index_pair_array(GlobalObject& global_object, Ut if (match_indices.has_value()) match_indices_array = get_match_index_par(global_object, string, *match_indices); - // d. Perform ! CreateDataProperty(A, ! ToString(i), matchIndicesArray). - MUST(array->create_data_property(i, match_indices_array)); + // d. Perform ! CreateDataPropertyOrThrow(A, ! ToString(i), matchIndicesArray). + MUST(array->create_data_property_or_throw(i, match_indices_array)); } for (auto const& entry : group_names) { auto match_indices_array = get_match_index_par(global_object, string, entry.value); // e. If i > 0 and groupNames[i - 1] is not undefined, then - // i. Perform ! CreateDataProperty(groups, groupNames[i - 1], matchIndicesArray). - MUST(groups.as_object().create_data_property(entry.key, match_indices_array)); + // ii. Perform ! CreateDataPropertyOrThrow(groups, groupNames[i - 1], matchIndicesArray). + MUST(groups.as_object().create_data_property_or_throw(entry.key, match_indices_array)); } - // 8. Perform ! CreateDataProperty(A, "groups", groups). + // 8. Perform ! CreateDataPropertyOrThrow(A, "groups", groups). // NOTE: This step must be performed after the above loops in order for groups to be populated. - MUST(array->create_data_property(vm.names.groups, groups)); + MUST(array->create_data_property_or_throw(vm.names.groups, groups)); // 10. Return A. return array; -- cgit v1.2.3