Skip to content

Commit 012f12b

Browse files
committed
[JSC] Add missing name property for %IntlSegmentsPrototype%[%Symbol.iterator%]
https://bugs.webkit.org/show_bug.cgi?id=296801 Reviewed by NOBODY (OOPS!). This patch changes to implement tc39/ecma402#1015 * Source/JavaScriptCore/runtime/IntlSegmentsPrototype.cpp: (JSC::IntlSegmentsPrototype::finishCreation):
1 parent a2b0df6 commit 012f12b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function shouldBe(a, b) {
2+
if (a !== b)
3+
throw new Error(`Expected ${b} but got ${a}`);
4+
}
5+
6+
s = new Intl.Segmenter()
7+
ss = s.segment("123")
8+
const iteratorFnName = ss[Symbol.iterator].name
9+
10+
shouldBe(iteratorFnName, "[Symbol.iterator]");

Source/JavaScriptCore/runtime/IntlSegmentsPrototype.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ void IntlSegmentsPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
6969
{
7070
Base::finishCreation(vm);
7171
ASSERT(inherits(info()));
72-
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->iteratorSymbol, intlSegmentsPrototypeFuncIterator, static_cast<unsigned>(PropertyAttribute::DontEnum), 0, ImplementationVisibility::Public);
72+
JSFunction* iteratorFunction = JSFunction::create(vm, globalObject, 0, "[Symbol.iterator]"_s, intlSegmentsPrototypeFuncIterator, ImplementationVisibility::Public);
73+
putDirectWithoutTransition(vm, vm.propertyNames->iteratorSymbol, iteratorFunction, static_cast<unsigned>(PropertyAttribute::DontEnum));
7374
}
7475

7576
// https://tc39.es/proposal-intl-segmenter/#sec-%segmentsprototype%.containing

0 commit comments

Comments
 (0)