On 2015/03/31 12:28:40, caitp wrote:
On 2015/03/31 10:09:43, Dmitry Lomov (chromium) wrote:
> My biggest concern is IsSuperFlag on CallRuntime node.
> Can you also provide a high-level explanation of desugaring, i.e. what:
>   f(x,y,...args);
>   new f(x,y,...args)
>   super(x,y,...args)
> desugar into in the AST


f(x, y, ...args) -> ReflectApply(f, undefined, SpreadArguments([x, y],
SpreadIterable(args))
new f(x, y, ...args) -> ReflectConstruct(f, SpreadArguments([x, y],
SpreadIterable(args))
super(x, y, ...args) -> this =
ReflectConstruct(GetPrototype(%CurrentFunction%),
SpreadArguments([x, y], SpreadIterable(args)), %NewTarget%)

To expand on this, it's very close to what Traceur is doing --- sequences of 1
or more non-spread arguments are expressed in array literals (done in the
parser), each spread argument is spread into an array (SpreadIterable does
this), and these arrays are joined into a single array (in SpreadArguments).

The array is passed as the arguments array, to either Reflect.apply, or
Reflect.construct, For Reflect.apply, the `this` value is either undefined, or
the object containing whatever property is being called.

For Reflect.construct, if the call is a super() call, the newTarget argument is
the a reference to the scope's new target binding



https://codereview.chromium.org/938443002/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to