@@ -6557,41 +6557,27 @@ Since the IDL {{any}} type
6557
6557
is the union of all other IDL types, it can correspond to any
6558
6558
ECMAScript value type.
6559
6559
6560
- <p id="es-to-any">
6561
- How to [=converted to an IDL value|convert an ECMAScript value=] to an IDL {{any}} value depends on the type of the
6562
- ECMAScript value:
6563
- </p>
6560
+ <div id="es-to-any" algorithm="convert an ECMAScript value to any">
6564
6561
6565
- <dl class="switch">
6566
- : The <emu-val>undefined</emu-val> value
6567
- :: The IDL value is an
6568
- {{object}} reference
6569
- to a special object that represents the ECMAScript
6570
- <emu-val>undefined</emu-val> value.
6571
- : The <emu-val>null</emu-val> value
6572
- :: The IDL value is the <emu-val>null</emu-val>
6573
- {{object|object?}} reference.
6574
- : A <emu-val>Boolean</emu-val> value
6575
- :: The IDL value is the
6576
- {{boolean}}
6577
- value that represents the same truth value.
6578
- : A <emu-val>Number</emu-val> value
6579
- :: The IDL value is that which is obtained
6580
- by following the rules for converting the
6581
- <emu-val>Number</emu-val> to an IDL
6582
- {{unrestricted double}} value,
6583
- as described in [[#es-unrestricted-double]].
6584
- : A <emu-val>String</emu-val> value
6585
- :: The IDL value is that which is obtained
6586
- by following the rules for converting the
6587
- <emu-val>String</emu-val> to an IDL
6588
- {{DOMString}} value,
6589
- as described in [[#es-DOMString]].
6590
- : An {{object}} value
6591
- :: The IDL value is an
6592
- {{object}} value that
6593
- references the same object.
6594
- </dl>
6562
+ An ECMAScript value |V| is [=converted to an IDL value|converted=]
6563
+ to an IDL {{any}} value by running the following algorithm:
6564
+
6565
+ 1. If |V| is <emu-val>undefined</emu-val>, then
6566
+ return an {{object}} reference to a special object that represents
6567
+ the ECMAScript <emu-val>undefined</emu-val> value.
6568
+ 1. If |V| is <emu-val>null</emu-val>, then
6569
+ return the <emu-val>null</emu-val> {{object|object?}} reference.
6570
+ 1. If [=Type=](|V|) is Boolean, then
6571
+ return the {{boolean}} value that represents the same truth value.
6572
+ 1. If [=Type=](|V|) is Number, then
6573
+ return the result of <a href="#es-to-unrestricted-double">converting</a> |V|
6574
+ to an {{unrestricted double}}.
6575
+ 1. If [=Type=](|V|) is String, then
6576
+ return the result of <a href="#es-DOMString">converting</a> |V|
6577
+ to a {{DOMString}}.
6578
+ 1. If [=Type=](|V|) is Object, then
6579
+ return an IDL {{object}} value that references |V|.
6580
+ </div>
6595
6581
6596
6582
<p id="any-to-es">
6597
6583
An IDL {{any}} value is
@@ -7321,7 +7307,7 @@ ECMAScript <emu-val>Array</emu-val> values.
7321
7307
An ECMAScript value |V| is [=converted to an IDL value|converted=]
7322
7308
to an IDL <a lt="sequence type">sequence<<var ignore>T</var>></a> value as follows:
7323
7309
7324
- 1. If |V| is not an object ,
7310
+ 1. If [=Type=]( |V|) is not Object ,
7325
7311
[=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
7326
7312
1. Let |method| be the result of
7327
7313
[=GetMethod=](|V|, [=@@iterator=]).
@@ -7641,8 +7627,7 @@ that correspond to the union’s [=member types=].
7641
7627
then return the IDL value <emu-val>null</emu-val>.
7642
7628
1. Let |types| be the [=flattened member types=]
7643
7629
of the [=union type=].
7644
- 1. If |V| is <emu-val>null</emu-val> or
7645
- <emu-val>undefined</emu-val>, then:
7630
+ 1. If |V| is <emu-val>null</emu-val> or <emu-val>undefined</emu-val>, then:
7646
7631
1. If |types| includes a [=dictionary type=], then return the
7647
7632
result of [=converted to an IDL value|converting=] |V| to that dictionary type.
7648
7633
1. If |types| includes a [=record type=], then return the
@@ -7659,25 +7644,25 @@ that correspond to the union’s [=member types=].
7659
7644
|V| to that type.
7660
7645
1. If |types| includes {{object}}, then return the IDL value
7661
7646
that is a reference to the object |V|.
7662
- 1. If |V| is a native <emu-val>Error</emu-val> object (that is, it has an \[[ErrorData]] [=internal slot=]), then:
7647
+ 1. If [=Type=]( |V|) is Object and |V| has an \[[ErrorData]] [=internal slot=]), then:
7663
7648
1. If |types| includes {{Error!!interface}}, then return the
7664
7649
result of [=converted to an IDL value|converting=]
7665
7650
|V| to {{Error!!interface}}.
7666
7651
1. If |types| includes {{object}}, then return the IDL value
7667
7652
that is a reference to the object |V|.
7668
- 1. If |V| is an object with an \[[ArrayBufferData]] [=internal slot=], then:
7653
+ 1. If [=Type=]( |V|) is Object and |V| has an \[[ArrayBufferData]] [=internal slot=], then:
7669
7654
1. If |types| includes {{ArrayBuffer}}, then return the
7670
7655
result of [=converted to an IDL value|converting=]
7671
7656
|V| to {{ArrayBuffer}}.
7672
7657
1. If |types| includes {{object}}, then return the IDL value
7673
7658
that is a reference to the object |V|.
7674
- 1. If |V| is an object with a \[[DataView]] [=internal slot=], then:
7659
+ 1. If [=Type=]( |V|) is Object and |V| has a \[[DataView]] [=internal slot=], then:
7675
7660
1. If |types| includes {{DataView}}, then return the
7676
7661
result of [=converted to an IDL value|converting=]
7677
7662
|V| to {{DataView}}.
7678
7663
1. If |types| includes {{object}}, then return the IDL value
7679
7664
that is a reference to the object |V|.
7680
- 1. If |V| is an object with a \[[TypedArrayName]] [=internal slot=], then:
7665
+ 1. If [=Type=]( |V|) is Object and |V| has a \[[TypedArrayName]] [=internal slot=], then:
7681
7666
1. If |types| includes a [=typed array type=]
7682
7667
whose name is the value of |V|’s \[[TypedArrayName]] [=internal slot=], then return the
7683
7668
result of [=converted to an IDL value|converting=]
@@ -7691,24 +7676,22 @@ that correspond to the union’s [=member types=].
7691
7676
|V| to that callback function type.
7692
7677
1. If |types| includes {{object}}, then return the IDL value
7693
7678
that is a reference to the object |V|.
7694
- 1. If |V| is any kind of object , then:
7679
+ 1. If [=Type=]( |V|) is Object , then:
7695
7680
1. If |types| includes a [=sequence type=], then
7696
7681
1. Let |method| be the result of
7697
7682
[=GetMethod=](|V|, [=@@iterator=]).
7698
7683
1. [=ReturnIfAbrupt=](|method|).
7699
- 1. If |method| is not
7700
- <emu-val>undefined</emu-val>,
7684
+ 1. If |method| is not <emu-val>undefined</emu-val>,
7701
7685
return the result of
7702
7686
[=creating a sequence from an iterable|creating a sequence=]
7703
7687
of that type from |V| and |method|.
7704
7688
1. If |types| includes a [=frozen array type=], then
7705
- 1. Let |method| be the result of
7706
- [=GetMethod=](|V|, [=@@iterator=]).
7689
+ 1. Let |method| be the result of [=GetMethod=](|V|, [=@@iterator=]).
7707
7690
1. [=ReturnIfAbrupt=](|method|).
7708
- 1. If |method| is not
7709
- <emu-val>undefined</emu-val>,
7691
+ 1. If |method| is not <emu-val>undefined</emu-val>,
7710
7692
return the result of
7711
- [=Creating a frozen array from an iterable|creating a frozen array of that type from V and method=].
7693
+ [=Creating a frozen array from an iterable|creating a frozen array=]
7694
+ of that type from |V| and |method|.
7712
7695
1. If |types| includes a [=dictionary type=], then return the
7713
7696
result of [=converted to an IDL value|converting=]
7714
7697
|V| to that dictionary type.
@@ -7721,11 +7704,11 @@ that correspond to the union’s [=member types=].
7721
7704
|V| to that interface type.
7722
7705
1. If |types| includes {{object}}, then return the IDL value
7723
7706
that is a reference to the object |V|.
7724
- 1. If |V| is a <emu-val> Boolean</emu-val> value , then:
7707
+ 1. If [=Type=]( |V|) is Boolean, then:
7725
7708
1. If |types| includes a {{boolean}},
7726
7709
then return the result of [=converted to an IDL value|converting=]
7727
7710
|V| to {{boolean}}.
7728
- 1. If |V| is a <emu-val> Number</emu-val> value , then:
7711
+ 1. If [=Type=]( |V|) is Number, then:
7729
7712
1. If |types| includes a [=numeric type=],
7730
7713
then return the result of [=converted to an IDL value|converting=]
7731
7714
|V| to that [=numeric type=].
@@ -9802,7 +9785,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9802
9785
9803
9786
then remove from |S| all other entries.
9804
9787
9805
- 1. Otherwise: if |V| is an <emu-val>Error</emu-val> object (that is, it has an \[[ErrorData]] [=internal slot=]) and
9788
+ 1. Otherwise: if [=Type=]( |V|) is Object, |V| has an \[[ErrorData]] [=internal slot=], and
9806
9789
there is an entry in |S| that has one of the following types at position |i| of its type list,
9807
9790
* {{Error!!interface}}
9808
9791
* {{object}}
@@ -9812,7 +9795,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9812
9795
9813
9796
then remove from |S| all other entries.
9814
9797
9815
- 1. Otherwise: if |V| is an object with an \[[ArrayBufferData]] [=internal slot=] and
9798
+ 1. Otherwise: if [=Type=]( |V|) is Object, |V| has an \[[ArrayBufferData]] [=internal slot=], and
9816
9799
there is an entry in |S| that has one of the following types at position |i| of its type list,
9817
9800
* {{ArrayBuffer}}
9818
9801
* {{object}}
@@ -9822,7 +9805,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9822
9805
9823
9806
then remove from |S| all other entries.
9824
9807
9825
- 1. Otherwise: if |V| is an object with a \[[DataView]] [=internal slot=] and
9808
+ 1. Otherwise: if [=Type=]( |V|) is Object, |V| has a \[[DataView]] [=internal slot=], and
9826
9809
there is an entry in |S| that has one of the following types at position |i| of its type list,
9827
9810
* {{DataView}}
9828
9811
* {{object}}
@@ -9832,7 +9815,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9832
9815
9833
9816
then remove from |S| all other entries.
9834
9817
9835
- 1. Otherwise: if |V| is an object with a \[[TypedArrayName]] [=internal slot=] and
9818
+ 1. Otherwise: if [=Type=]( |V|) is Object, |V| has a \[[TypedArrayName]] [=internal slot=], and
9836
9819
there is an entry in |S| that has one of the following types at position |i| of its type list,
9837
9820
* a [=typed array type=] whose name
9838
9821
is equal to the value of |V|’s \[[TypedArrayName]] [=internal slot=]
@@ -9853,7 +9836,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9853
9836
9854
9837
then remove from |S| all other entries.
9855
9838
9856
- 1. Otherwise: if |V| is any kind of object, and
9839
+ 1. Otherwise: if [=Type=]( |V|) is Object and
9857
9840
there is an entry in |S| that has one of the
9858
9841
following types at position |i| of its type list,
9859
9842
* a [=sequence type=]
@@ -9871,7 +9854,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9871
9854
|method| is not <emu-val>undefined</emu-val>, then remove from |S| all
9872
9855
other entries.
9873
9856
9874
- 1. Otherwise: if |V| is any kind of object, and
9857
+ 1. Otherwise: if [=Type=]( |V|) is Object and
9875
9858
there is an entry in |S| that has one of the following types at position |i| of its type list,
9876
9859
* a [=callback interface=] type
9877
9860
* a [=dictionary type=]
@@ -9883,7 +9866,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9883
9866
9884
9867
then remove from |S| all other entries.
9885
9868
9886
- 1. Otherwise: if |V| is a <emu-val> Boolean</emu-val> value,
9869
+ 1. Otherwise: if [=Type=]( |V|) is Boolean
9887
9870
and there is an entry in |S| that has one of the following types at position |i| of its type list,
9888
9871
* {{boolean}}
9889
9872
* a [=nullable type|nullable=] {{boolean}}
@@ -9892,7 +9875,7 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
9892
9875
9893
9876
then remove from |S| all other entries.
9894
9877
9895
- 1. Otherwise: if |V| is a <emu-val> Number</emu-val> value,
9878
+ 1. Otherwise: if [=Type=]( |V|) is Number
9896
9879
and there is an entry in |S| that has one of the following types at position |i| of its type list,
9897
9880
* a [=numeric type=]
9898
9881
* a [=nullable type|nullable=] [=numeric type=]
@@ -10167,9 +10150,9 @@ whose value is the identifier of the corresponding interface.
10167
10150
every [=interface object=] |A| must behave as follows,
10168
10151
assuming |V| is the object argument passed to \[[HasInstance]]:
10169
10152
10170
- 1. If |V| is not an object , return <emu-val>false</emu-val>.
10153
+ 1. If Type( |V|) is not Object , return <emu-val>false</emu-val>.
10171
10154
1. Let |O| be the result of calling the \[[Get]] method of |A| with property name “prototype”.
10172
- 1. If |O| is not an object , [=ECMAScript/throw=] a <emu-val>TypeError</emu-val> exception.
10155
+ 1. If Type( |O|) is not Object , [=ECMAScript/throw=] a <emu-val>TypeError</emu-val> exception.
10173
10156
1. If |V| is a platform object that implements the
10174
10157
interface for which |O| is the [=interface prototype object=],
10175
10158
return <emu-val>true</emu-val>.
0 commit comments