[Webkit-unassigned] [Bug 167962] [ESnext] Implement Object Rest - Implementing Object Rest Destructuring

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 21 15:50:46 PDT 2017


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

--- Comment #70 from Caio Lima <ticaiolima at gmail.com> ---
Comment on attachment 310597
  --> https://bugs.webkit.org/attachment.cgi?id=310597
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=310597&action=review

>> Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig:78
>> +ENABLE_ESNEXT_OBJ_REST_SPREAD = ENABLE_ESNEXT_OBJ_REST_SPREAD;
> 
> Lets make it a runtime option, not a compile time one.

ok

>> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:4071
>> +        generator.emitLoad(excludedIndex.get(), jsNumber(0));
> 
> Please don't do this. You should just build the Set in bytecode. There is no need to first build an array, and then have your builtin convert the array to a set.

I also think it's better use JSSet, but there is a thing that I'm worried:

If our implementation uses JSSet directly and then user overrides the Set.prototype.add, the rest semantics will be broken.

like:

```
Set.prototype.add = () => false;

let {a, b, ...r} = {a: 1, b: 2, c: 3, d: 4};

// here "r" will contain "a" and "b", and it will be wrong.

```

Do you think it is right?

>> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:-4076
>> -            RefPtr<RegisterID> propertyName = generator.emitNode(target.propertyExpression);
> 
> Can you add an assertion here of what the bindingType is? Also, I think it's worth adding an assertion that this is the last thing in the list, otherwise this algorithm is broken.

ok

>> Source/JavaScriptCore/parser/Parser.cpp:980
>> +        return 0;
> 
> bad indentation

Oops.

>> Source/JavaScriptCore/parser/Parser.cpp:1070
>> +            if (UNLIKELY(match(DOTDOTDOT))) {
> 
> Is this syntactically required to be the last element in the destrucruting clause?
> Also, no need for UNLIKELY, we're just going to negatively impact parsing code that uses this.

Yes. I will remove the UNLIKELY here.

-- 
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/20170521/d0212c78/attachment.html>


More information about the webkit-unassigned mailing list