[Webkit-unassigned] [Bug 143012] ES6: Classes: Early return in sub-class constructor results in returning undefined instead of instance

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 24 13:13:42 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=143012

Joseph Pecoraro <joepeck at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joepeck at webkit.org

--- Comment #1 from Joseph Pecoraro <joepeck at webkit.org> ---
I think the relevant portion is [[Construct]]:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-construct-argumentslist-newtarget

Which has:

>  13. If result.[[type]] is return, then
>      a. If Type(result.[[value]]) is Object, return NormalCompletion(result.[[value]]).
>      b. If kind is "base", return NormalCompletion(thisArgument).
>      c. If result.[[value]] is not undefined, throw a TypeError exception.
>  14. Else, ReturnIfAbrupt(result).
>  15. Return envRec.GetThisBinding().


That seems weird to me. It sounds like if you early return from a base class constructor, you will get the "thisArgument". And if you early return from a derived class constructor we return "envRec.GetThisBinding()".

Either way, my interpretation is that if we do an implicit return of undefined, we would get some "this" object.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150324/f4b3795b/attachment-0002.html>


More information about the webkit-unassigned mailing list