Skip to content

Commit

Permalink
Clarify object creation in named constructors (#652)
Browse files Browse the repository at this point in the history
This matches the text for normal constructors. I forgot to update this
algorithm in 8e1b529.
  • Loading branch information
Ms2ger committed Feb 25, 2019
1 parent 27afa8c commit c9246d4
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -10724,11 +10724,10 @@ the <code>typeof</code> operator will return "function" when applied to an inter
1. Perform the actions listed in the description of |constructor|
with |values| as the argument values
and |object| as the <emu-val>this</emu-val> value.
Rethrow any exceptions.
1. Let |O| be the result of [=converted to an ECMAScript value|converting=] |object|
to an ECMAScript [=interface type=] value |I|.
1. Assert: |O| is an object that implements |I|.
1. Assert: |O|.\[[Realm]] is equal to |realm|.
1. Assert: |O|.\[[Realm]] is |realm|.
1. Return |O|.
1. Let |constructorProto| be |realm|.\[[Intrinsics]].[[{{%FunctionPrototype%}}]].
1. If |I| inherits from some other interface |P|,
Expand Down Expand Up @@ -10763,10 +10762,6 @@ It allows constructing objects that
implement the interface on which the
[{{NamedConstructor}}] extended attributes appear.

If the actions listed in the description of the constructor return normally,
then those steps must return an object that implements interface |I|.
This object's relevant [=Realm=] must be the same as that of the [=named constructor=].

<div algorithm>

The [=named constructor=] with [=NamedConstructor identifier|identifier=] |id|
Expand All @@ -10783,10 +10778,17 @@ This object's relevant [=Realm=] must be the same as that of the [=named constru
and with argument count |n|.
1. Let &lt;|constructor|, |values|&gt; be the result of passing |S| and
|args| to the [=overload resolution algorithm=].
1. Let |R| be the result of performing the actions listed in the description of
|constructor| with |values| as the argument values.
1. Return the result of [=converted to an ECMAScript value|converting=]
|R| to an ECMAScript [=interface type=] value |I|.
1. Let |object| be the result of [=internally create a new object implementing the
interface|internally creating a new object implementing=] |I|, with |realm| and
{{NewTarget}}.
1. Perform the actions listed in the description of |constructor|
with |values| as the argument values
and |object| as the <emu-val>this</emu-val> value.
1. Let |O| be the result of [=converted to an ECMAScript value|converting=] |object|
to an ECMAScript [=interface type=] value |I|.
1. Assert: |O| is an object that implements |I|.
1. Assert: |O|.\[[Realm]] is |realm|.
1. Return |O|.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. Initialize |S| to the [=effective overload set=]
Expand Down

0 comments on commit c9246d4

Please sign in to comment.