[Webkit-unassigned] [Bug 172419] New: [JSC] Introduce @nakedConstructor to builtin JS

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat May 20 13:30:50 PDT 2017


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

            Bug ID: 172419
           Summary: [JSC] Introduce @nakedConstructor to builtin JS
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: utatane.tea at gmail.com

I would like to introduce a new function annotation (like @globalPrivate), @nakedConstructor.
If this annotation is attached, the function becomes constructor, but it does not create_this automatically.
The function need to return an object constructed from this function. Of course, the function need to care about new.target.

This is very useful for Map, Set, and Promise constructors. These constructors do some JS specific things.
For example, Set constructor takes an iterable object as its argument. And perform iteration and add values to the constructed object.
If we can write it in JS, it is very nice...
In the case of Promise, promise will invoke executor function, (new Promise(executor)). Currently, we always invoke this function in a tricky way.
If we can implement the Promise constructor like the following, it is quite nice.

@nakedConstructor
function Promise(executor)
{
    'use strict';

    var promise = @constructPromise(new.target);
    // some initialization...
    executor(promise.resolve, promise.reject);
    return promise;
}

-- 
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/20170520/84741835/attachment.html>


More information about the webkit-unassigned mailing list