diff --git a/index.html b/index.html index 684e14a..ea4d5d3 100644 --- a/index.html +++ b/index.html @@ -3511,7 +3511,7 @@

1.5.4.2 MessageFormat String Functions

When a MessageFormat string function is called with arguments funcCtx (an Object), options (an Object), and input (an ECMAScript language value), the following steps are taken:

-
  1. Let str be ? ToString(input).
  2. 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 »).
    2. If keyList contains str, return str.
    3. Else, return null.
  3. Let selectKey be CreateBuiltinFunction(selectKeyClosure, 1, "selectKey", « »).
  4. 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").
    2. Let locale be ! Get(funcCtx, "locale").
    3. Let locale0 be ! Get(locale, "0").
    4. Let result be OrdinaryObjectCreate(%Object.prototype%).
    5. Perform ! CreateDataPropertyOrThrow(result, "type", "string").
    6. Perform ! CreateDataPropertyOrThrow(result, "source", source).
    7. Perform ! CreateDataPropertyOrThrow(result, "locale", locale0).
    8. Perform ! CreateDataPropertyOrThrow(result, "value", str).
    9. Return CreateArrayFromList(« result »).
  5. Let toParts be CreateBuiltinFunction(toPartsClosure, 0, "toParts", « »).
  6. Let toStringClosure be a new Abstract Closure with no parameters that captures str and performs the following steps when called:
    1. Return str.
  7. Let toString be CreateBuiltinFunction(toStringClosure, 0, "toString", « »).
  8. Let valueOf be CreateBuiltinFunction(toStringClosure, 0, "valueOf", « »).
  9. Let mv be OrdinaryObjectCreate(%Object.prototype%).
  10. Perform ! CreateDataPropertyOrThrow(mv, "type", "number").
  11. Perform ! CreateDataPropertyOrThrow(mv, "source", source).
  12. Perform ! CreateDataPropertyOrThrow(mv, "locale", numberFormat.[[Locale]]).
  13. Perform ! CreateDataPropertyOrThrow(mv, "options", opts).
  14. Perform ! CreateDataPropertyOrThrow(mv, "selectKey", selectKey).
  15. Perform ! CreateDataPropertyOrThrow(mv, "toParts", toParts).
  16. Perform ! CreateDataPropertyOrThrow(mv, "toString", toString).
  17. Perform ! CreateDataPropertyOrThrow(mv, "valueOf", valueOf).
  18. Return mv.
+
  1. Let str be ? ToString(input).
  2. Let source be ! Get(funcCtx, "source").
  3. Let locale be ! Get(funcCtx, "locale").
  4. Let locale0 be ! Get(locale, "0").
  5. 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 »).
    2. If keyList contains str, return str.
    3. Else, return null.
  6. Let selectKey be CreateBuiltinFunction(selectKeyClosure, 1, "selectKey", « »).
  7. Let toPartsClosure be a new Abstract Closure with no parameters that captures funcCtx and str and performs the following steps when called:
    1. Let result be OrdinaryObjectCreate(%Object.prototype%).
    2. Perform ! CreateDataPropertyOrThrow(result, "type", "string").
    3. Perform ! CreateDataPropertyOrThrow(result, "source", source).
    4. Perform ! CreateDataPropertyOrThrow(result, "locale", locale0).
    5. Perform ! CreateDataPropertyOrThrow(result, "value", str).
    6. Return CreateArrayFromList(« result »).
  8. Let toParts be CreateBuiltinFunction(toPartsClosure, 0, "toParts", « »).
  9. Let toStringClosure be a new Abstract Closure with no parameters that captures str and performs the following steps when called:
    1. Return str.
  10. Let toString be CreateBuiltinFunction(toStringClosure, 0, "toString", « »).
  11. Let valueOf be CreateBuiltinFunction(toStringClosure, 0, "valueOf", « »).
  12. Let mv be OrdinaryObjectCreate(%Object.prototype%).
  13. Perform ! CreateDataPropertyOrThrow(mv, "type", "string").
  14. Perform ! CreateDataPropertyOrThrow(mv, "source", source).
  15. Perform ! CreateDataPropertyOrThrow(mv, "locale", locale0).
  16. Perform ! CreateDataPropertyOrThrow(mv, "selectKey", selectKey).
  17. Perform ! CreateDataPropertyOrThrow(mv, "toParts", toParts).
  18. Perform ! CreateDataPropertyOrThrow(mv, "toString", toString).
  19. Perform ! CreateDataPropertyOrThrow(mv, "valueOf", valueOf).
  20. Return mv.

The "length" property of a MessageFormat string function is 3. diff --git a/spec.emu b/spec.emu index 2b4eb41..cec8821 100644 --- a/spec.emu +++ b/spec.emu @@ -518,15 +518,15 @@ contributors: Eemeli Aro 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_). @@ -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_).