Skip to content

Commit 75582d9

Browse files
authored
Make call/construct/invoke either return an IDL value or throw
Their logic was relying too heavily on an implicit conversion between JS completion values and returning/throwing, which was especially confusing when we also had to deal with conversions between JS and IDL values.
1 parent c45a0f3 commit 75582d9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

index.bs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14188,12 +14188,12 @@ the special value “missing”, which represents a missing optional argument.
1418814188
|callResult|.\[[Value]] to an IDL value of the same type as the operation's
1418914189
return type.
1419014190
1. <i id="call-user-object-operation-return">Return:</i> at this
14191-
point |completion| will be set to an ECMAScript completion value.
14191+
point |completion| will be set to an IDL value or an [=abrupt completion=].
1419214192
1. [=Clean up after running a callback=] with |stored settings|.
1419314193
1. [=Clean up after running script=] with |relevant settings|.
14194-
1. If |completion| is a normal completion, return |completion|.
14194+
1. If |completion| is an IDL value, return |completion|.
1419514195
1. If |completion| is an [=abrupt completion=] and the operation has a [=return type=]
14196-
that is <em>not</em> a [=promise type=], return |completion|.
14196+
that is <em>not</em> a [=promise type=], throw |completion|.\[[Value]].
1419714197
1. Let |rejectedPromise| be [=!=] <a abstract-op>Call</a>({{%Promise.reject%}},
1419814198
{{%Promise%}}, «|completion|.\[[Value]]»).
1419914199
1. Return the result of [=converted to an IDL value|converting=]
@@ -14276,12 +14276,12 @@ described in the previous section).
1427614276
|callResult|.\[[Value]] to an IDL value of the same type as the operation's
1427714277
return type.
1427814278
1. <i id="invoke-return">Return:</i> at this
14279-
point |completion| will be set to an ECMAScript completion value.
14279+
point |completion| will be set to an IDL value or an [=abrupt completion=].
1428014280
1. [=Clean up after running a callback=] with |stored settings|.
1428114281
1. [=Clean up after running script=] with |relevant settings|.
14282-
1. If |completion| is a normal completion, return |completion|.
14282+
1. If |completion| is an IDL value, return |completion|.
1428314283
1. If |completion| is an [=abrupt completion=] and the callback function has a
14284-
[=return type=] that is <em>not</em> a [=promise type=], return |completion|.
14284+
[=return type=] that is <em>not</em> a [=promise type=], throw |completion|.\[[Value]].
1428514285
1. Let |rejectedPromise| be [=!=] <a abstract-op>Call</a>({{%Promise.reject%}},
1428614286
{{%Promise%}}, «|completion|.\[[Value]]»).
1428714287
1. Return the result of [=converted to an IDL value|converting=]
@@ -14318,9 +14318,10 @@ a return type that is a [=promise type=].
1431814318
|callResult|.\[[Value]] to an IDL value of the same type as the operation's
1431914319
return type.
1432014320
1. <i id="construct-return">Return:</i> at this
14321-
point |completion| will be set to an ECMAScript completion value.
14321+
point |completion| will be set to an IDL value or an [=abrupt completion=].
1432214322
1. [=Clean up after running a callback=] with |stored settings|.
1432314323
1. [=Clean up after running script=] with |relevant settings|.
14324+
1. If |completion| is an [=abrupt completion=], throw |completion|.\[[Value]].
1432414325
1. Return |completion|.
1432514326
</div>
1432614327

0 commit comments

Comments
 (0)