Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3511,7 +3511,7 @@ <h1><span class="secnum">1.5.4.2</span> MessageFormat String Functions</h1>
When a MessageFormat string function is called with arguments <var>funcCtx</var> (an Object), <var>options</var> (an Object), and <var>input</var> (an ECMAScript language value), the following steps are taken:
</p>

<emu-alg><ol><li>Let <var>str</var> be ?&nbsp;ToString(<var>input</var>).</li><li>Let <var>selectKeyClosure</var> be a new Abstract Closure with parameters (<var>keys</var>) that captures <var>str</var> and performs the following steps when called:<ol><li>Let <var>keyList</var> be ?&nbsp;CreateListFromArrayLike(<var>keys</var>, « String&nbsp;»).</li><li>If <var>keyList</var> contains <var>str</var>, return <var>str</var>.</li><li>Else, return <emu-val>null</emu-val>.</li></ol></li><li>Let <var>selectKey</var> be CreateBuiltinFunction(<var>selectKeyClosure</var>, <emu-val>1</emu-val>, <emu-val>"selectKey"</emu-val>, «&nbsp;»).</li><li>Let <var>toPartsClosure</var> be a new Abstract Closure with no parameters that captures <var>funcCtx</var> and <var>str</var> and performs the following steps when called:<ol><li>Let <var>source</var> be !&nbsp;Get(<var>funcCtx</var>, <emu-val>"source"</emu-val>).</li><li>Let <var>locale</var> be !&nbsp;Get(<var>funcCtx</var>, <emu-val>"locale"</emu-val>).</li><li>Let <var>locale0</var> be !&nbsp;Get(<var>locale</var>, <emu-val>"0"</emu-val>).</li><li>Let <var>result</var> be OrdinaryObjectCreate(%Object.prototype%).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"type"</emu-val>, <emu-val>"string"</emu-val>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"source"</emu-val>, <var>source</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"locale"</emu-val>, <var>locale0</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"value"</emu-val>, <var>str</var>).</li><li>Return CreateArrayFromList(« <var>result</var>&nbsp;»).</li></ol></li><li>Let <var>toParts</var> be CreateBuiltinFunction(<var>toPartsClosure</var>, <emu-val>0</emu-val>, <emu-val>"toParts"</emu-val>, «&nbsp;»).</li><li>Let <var>toStringClosure</var> be a new Abstract Closure with no parameters that captures <var>str</var> and performs the following steps when called:<ol><li>Return <var>str</var>.</li></ol></li><li>Let <var>toString</var> be CreateBuiltinFunction(<var>toStringClosure</var>, <emu-val>0</emu-val>, <emu-val>"toString"</emu-val>, «&nbsp;»).</li><li>Let <var>valueOf</var> be CreateBuiltinFunction(<var>toStringClosure</var>, <emu-val>0</emu-val>, <emu-val>"valueOf"</emu-val>, «&nbsp;»).</li><li>Let <var>mv</var> be OrdinaryObjectCreate(%Object.prototype%).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"type"</emu-val>, <emu-val>"number"</emu-val>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"source"</emu-val>, <var>source</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"locale"</emu-val>, <var>numberFormat</var>.<var class="field">[[Locale]]</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"options"</emu-val>, <var>opts</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"selectKey"</emu-val>, <var>selectKey</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"toParts"</emu-val>, <var>toParts</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"toString"</emu-val>, <var>toString</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"valueOf"</emu-val>, <var>valueOf</var>).</li><li>Return <var>mv</var>.</li></ol></emu-alg>
<emu-alg><ol><li>Let <var>str</var> be ?&nbsp;ToString(<var>input</var>).</li><li>Let <var>source</var> be !&nbsp;Get(<var>funcCtx</var>, <emu-val>"source"</emu-val>).</li><li>Let <var>locale</var> be !&nbsp;Get(<var>funcCtx</var>, <emu-val>"locale"</emu-val>).</li><li>Let <var>locale0</var> be !&nbsp;Get(<var>locale</var>, <emu-val>"0"</emu-val>).</li><li>Let <var>selectKeyClosure</var> be a new Abstract Closure with parameters (<var>keys</var>) that captures <var>str</var> and performs the following steps when called:<ol><li>Let <var>keyList</var> be ?&nbsp;CreateListFromArrayLike(<var>keys</var>, « String&nbsp;»).</li><li>If <var>keyList</var> contains <var>str</var>, return <var>str</var>.</li><li>Else, return <emu-val>null</emu-val>.</li></ol></li><li>Let <var>selectKey</var> be CreateBuiltinFunction(<var>selectKeyClosure</var>, <emu-val>1</emu-val>, <emu-val>"selectKey"</emu-val>, «&nbsp;»).</li><li>Let <var>toPartsClosure</var> be a new Abstract Closure with no parameters that captures <var>funcCtx</var> and <var>str</var> and performs the following steps when called:<ol><li>Let <var>result</var> be OrdinaryObjectCreate(%Object.prototype%).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"type"</emu-val>, <emu-val>"string"</emu-val>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"source"</emu-val>, <var>source</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"locale"</emu-val>, <var>locale0</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>result</var>, <emu-val>"value"</emu-val>, <var>str</var>).</li><li>Return CreateArrayFromList(« <var>result</var>&nbsp;»).</li></ol></li><li>Let <var>toParts</var> be CreateBuiltinFunction(<var>toPartsClosure</var>, <emu-val>0</emu-val>, <emu-val>"toParts"</emu-val>, «&nbsp;»).</li><li>Let <var>toStringClosure</var> be a new Abstract Closure with no parameters that captures <var>str</var> and performs the following steps when called:<ol><li>Return <var>str</var>.</li></ol></li><li>Let <var>toString</var> be CreateBuiltinFunction(<var>toStringClosure</var>, <emu-val>0</emu-val>, <emu-val>"toString"</emu-val>, «&nbsp;»).</li><li>Let <var>valueOf</var> be CreateBuiltinFunction(<var>toStringClosure</var>, <emu-val>0</emu-val>, <emu-val>"valueOf"</emu-val>, «&nbsp;»).</li><li>Let <var>mv</var> be OrdinaryObjectCreate(%Object.prototype%).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"type"</emu-val>, <emu-val>"string"</emu-val>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"source"</emu-val>, <var>source</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"locale"</emu-val>, <var>locale0</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"selectKey"</emu-val>, <var>selectKey</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"toParts"</emu-val>, <var>toParts</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"toString"</emu-val>, <var>toString</var>).</li><li>Perform !&nbsp;CreateDataPropertyOrThrow(<var>mv</var>, <emu-val>"valueOf"</emu-val>, <var>valueOf</var>).</li><li>Return <var>mv</var>.</li></ol></emu-alg>

<p>
The <emu-val>"length"</emu-val> property of a MessageFormat string function is <emu-val>3</emu-val>.
Expand Down
11 changes: 5 additions & 6 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,15 @@ contributors: Eemeli Aro

<emu-alg>
1. Let _str_ be ? ToString(_input_).
1. Let _source_ be ! Get(_funcCtx_, *"source"*).
1. Let _locale_ be ! Get(_funcCtx_, *"locale"*).
1. Let _locale0_ be ! Get(_locale_, *"0"*).
1. Let _selectKeyClosure_ be a new Abstract Closure with parameters (_keys_) that captures _str_ and performs the following steps when called:
1. Let _keyList_ be ? CreateListFromArrayLike(_keys_, « String »).
1. If _keyList_ contains _str_, return _str_.
1. Else, return *null*.
1. Let _selectKey_ be CreateBuiltinFunction(_selectKeyClosure_, *1*, *"selectKey"*, « »).
1. Let _toPartsClosure_ be a new Abstract Closure with no parameters that captures _funcCtx_ and _str_ and performs the following steps when called:
1. Let _source_ be ! Get(_funcCtx_, *"source"*).
1. Let _locale_ be ! Get(_funcCtx_, *"locale"*).
1. Let _locale0_ be ! Get(_locale_, *"0"*).
1. Let _result_ be OrdinaryObjectCreate(%Object.prototype%).
1. Perform ! CreateDataPropertyOrThrow(_result_, *"type"*, *"string"*).
1. Perform ! CreateDataPropertyOrThrow(_result_, *"source"*, _source_).
Expand All @@ -539,10 +539,9 @@ contributors: Eemeli Aro
1. Let _toString_ be CreateBuiltinFunction(_toStringClosure_, *0*, *"toString"*, « »).
1. Let _valueOf_ be CreateBuiltinFunction(_toStringClosure_, *0*, *"valueOf"*, « »).
1. Let _mv_ be OrdinaryObjectCreate(%Object.prototype%).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"type"*, *"number"*).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"type"*, *"string"*).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"source"*, _source_).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"locale"*, _numberFormat_.[[Locale]]).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"options"*, _opts_).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"locale"*, _locale0_).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"selectKey"*, _selectKey_).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"toParts"*, _toParts_).
1. Perform ! CreateDataPropertyOrThrow(_mv_, *"toString"*, _toString_).
Expand Down