[INTL] Implement Number.prototype.toLocaleString in ECMA-402
https://bugs.webkit.org/show_bug.cgi?id=147610
Patch by Andy VanWagoner <[email protected]> on 2015-12-04
Reviewed by Benjamin Poulain.
Source/JavaScriptCore:
Add toLocaleString in builtin JavaScript that delegates formatting to Intl.NumberFormat.
Keep exisiting native implementation for use if INTL flag is disabled.
- CMakeLists.txt: Add NumberPrototype.js.
- DerivedSources.make: Add NumberPrototype.js.
- JavaScriptCore.xcodeproj/project.pbxproj:
- builtins/NumberPrototype.js: Added.
(toLocaleString):
- runtime/CommonIdentifiers.h: Add private names for Intl constructors.
- runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init): Expose Intl constructors to builtin js.
- runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::finishCreation): Replace toLocaleString implementation.
LayoutTests:
Add tests for ECMA-402 Number.prototype.toLocaleString.
Since NumberFormat is not fully implemented, don't test locale-specific behavior yet.
- js/number-toLocaleString-expected.txt: Added.
- js/number-toLocaleString.html: Added.
- js/script-tests/number-toLocaleString.js: Added.